私のJAVAFXアプリケーションでは、タイルペインにイメージビューがあります。Androidのイメージのような機能のような複数選択を実装したいと考えています。クリックイベントでimageViewにボーダースタイルを追加しようとしましたが、うまくいきませんでした。これを達成する方法はありますか。
1 に答える
1
Image
を JavaFXに組み込み、のメソッドをButton
設定できます。OnAction
Button
imageButton.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
System.out.println("Changing the color of the button's border :");
imageButton.setStyle("-fx-border-color:blue;");
System.out.println("For further reference, you can save the button or the image in a TreeSet:");
treeSet.add(imageButton);
}
});
クリックするだけで画像を選択できる場合は、上記のように Button の OnAction メソッドを定義できます。ただし、画像の選択状態を変更するために長いクリック (Android スタイルで押したままにする) が必要な場合は、「押したままにする」の詳細については、ここをクリックしてください。.
于 2016-08-08T22:01:43.070 に答える