ユーザーが選択するイメージのrawを作成します。私はjavafxイメージの色の変更
FileInputStream seats_fileInputStream = new FileInputStream("seat.png");
Image seats_image = new Image(seats_fileInputStream,50,50,false,false);
ImageView[] seats = new ImageView[30];
for(int i = 0;i<30;i++){
seats[i] = new ImageView(seats_image);
}
HBox seatsRaw_hbox[] = new HBox[5];
VBox seatsLine_vbox = new VBox();
int seatsCount = 0;
for(int i=0;i<5;i++){
seatsRaw_hbox[i]= new HBox();
for(int j=0;j<6;j++){
seatsRaw_hbox[i].getChildren().addAll(seats[seatsCount]);
seatsCount++;
}
seatsLine_vbox.getChildren().add(seatsRaw_hbox[i]);
}
BorderPane Test = new BorderPane();
Test.setCenter(seatsLine_vbox);
その上でユーザーがクリック後の画像は、その色を変更したい、それがクリックされたら緑色に画像を変更しようとしているイム:
Color targetColor = Color.GREEN;
ColorAdjust colorAdjust = new ColorAdjust();
colorAdjust.setSaturation(targetColor.getSaturation());
colorAdjust.setHue(targetColor.getHue());
colorAdjust.setBrightness(targetColor.getBrightness());
seats[0].setOnMouseClicked(e->{
seats[0].setEffect(colorAdjust);
});
しかし、私は奇妙な色
を得続けますOrginal画像:
私は一度得た奇妙な結果は、私がクリック:あなたがあなたの目的のために間違った効果を使用している
_ _「私は奇妙な色を得続ける」 - いくつかのサンプルを説明し、提供してください。 –
また、 'seat.png'イメージはどのように見えますか? – fabian
@JimGarrison私は既に質問を編集します – MrRizk