Skip to content

Instantly share code, notes, and snippets.

@budougumi0617
Last active August 29, 2015 14:10
Show Gist options
  • Save budougumi0617/4d8ceb894f0da06e6188 to your computer and use it in GitHub Desktop.
Save budougumi0617/4d8ceb894f0da06e6188 to your computer and use it in GitHub Desktop.
JavaFX Nightに参加してきた #javafx_ja ref: http://qiita.com/budougumi0617/items/64ef299d620896288dc9
//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
}
prop.addlistener( (observable, oldValue, newVlue)-> {
//ChangeListenerで登録する処理
});
prop.addlistener( observable -> {
//InvalidationListenerで登録する処理
});
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(); }
}
circle.radiusProperty().bind(
Bindings.divide(
Bindings.when(
Bindings.lessThanOrEqual(scene.widthProperty(),
scene.heightProperty()))
.then(scene.widthProperty())
.otherwise(scene.heightProperty()), 2));
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