Last active
August 29, 2015 14:13
-
-
Save KingC100/84adc17e66206d09c6c1 to your computer and use it in GitHub Desktop.
URL解決できないやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import略 | |
@FXML TextField txb_Own_1; | |
@FXML TextField txb_Own_2; | |
ReadContents rc = new ReadContents(); | |
@Override | |
public void initialize(URL url, ResourceBundle rb) { | |
/*** | |
* アイコンの自動更新処理 | |
* テキストボックス内の文字が変更されたら呼び出される。 | |
*/ | |
// 上手く行くほう | |
txb_Own_1.textProperty().addListener((ObservableValue<? extends String> observableValue, String s, String s2) -> { | |
Image img = new Image((getClass().getResource(rc.GetPath(txb_Own_1.getText()))).toString()); | |
img_Own_1.setImage(img); | |
}); | |
// コケる方 | |
txb_Own_2.textProperty().addListener((ObservableValue<? extends String> observableValue, String s, String s2) -> { | |
Image img = new Image( rc.GetPath(txb_Own_2.getText())); | |
img_Own_2.setImage(img); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment