FXMLを使用してイメージビュー内のイメージを変更し、イメージを変更するfileChooserを開いて古いイメージを置き換えるイメージを選択するには、今すぐ2つの問題があります。FXML/JavaFX ImageViewをクリック可能にする方法は?
ImageViewの作成方法
<ImageView fx:id="Defaultview" fitHeight="93" fitWidth="93"
pickOnBounds="true" preserveRatio="true" onAction='#imagePicker'>
と私は
からそれを変更したい画像の変更のため:クリッカブルこれは私が持っている私のFXMLファイルでこのpublic void imagePicker(){
Defaultview.setPickOnBounds(true); // allows click on transparent areas
Defaultview.setOnMouseClicked((MouseEvent e) -> {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open Resource File");
fileChooser.showOpenDialog(new Stage());
});
}
のために使っていたコードです
Image url="@../images/default.png"
to the Image選択しました。
FXMLを削除したのはなぜですか?なぜ私の書式修正を削除したのですか? –