Last active
August 29, 2015 14:10
-
-
Save budougumi0617/4d8ceb894f0da06e6188 to your computer and use it in GitHub Desktop.
JavaFX Nightに参加してきた #javafx_ja ref: http://qiita.com/budougumi0617/items/64ef299d620896288dc9
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
//CONFIRMATIONダイアログ生成 | |
Alert alert = new Alert(AlertType.CONFIRMATION); | |
//DaialogPaneの各領域に値を設定 | |
alert.setTitle("Confirmation Dialog"); | |
alert.setHeaderText("Look, a Confirmation Dialog"); | |
alert.setContentText("Are you ok with this?"); | |
//Alertダイアログなので、戻り値はOprtional<ButtonType> | |
Optional<ButtonType> result = alert.showAndWait(); | |
if (result.get() == ButtonType.OK){ | |
// ... user chose OK | |
} else { | |
// ... user chose CANCEL or closed the dialog | |
} |
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
prop.addlistener( (observable, oldValue, newVlue)-> { | |
//ChangeListenerで登録する処理 | |
}); | |
prop.addlistener( observable -> { | |
//InvalidationListenerで登録する処理 | |
}); |
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
public class Greeting { | |
private StringProperty text = new SimpleStringProperty(""); | |
public final StringProperty textProperty() { return text; } | |
public final void setText(String newValue) { text.set(newValue); } | |
public final String getText() { return text.get(); } | |
} |
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
circle.radiusProperty().bind( | |
Bindings.divide( | |
Bindings.when( | |
Bindings.lessThanOrEqual(scene.widthProperty(), | |
scene.heightProperty())) | |
.then(scene.widthProperty()) | |
.otherwise(scene.heightProperty()), 2)); |
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
ObjectBinding<Color> objectBinding = new ObjectBinding<Color>() { | |
{ | |
super.bind(slider1.valueProperty(), | |
slider2.valueProperty(), | |
slider3.valueProperty()); | |
} | |
@Override | |
protected Color computeValue() { | |
return Color.color(slider1.valueProperty().get(), | |
slider2.valueProperty().get(), | |
slider3.valueProperty().get()); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment