setPadding(new Insets(10, 20, 10, 10));
setVgap(10);
setHgap(10);
GridPane.setConstraints(splineEditorControl, 0, 0, 1, 10
, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
final Label codeLabel = new Label();
codeLabel.setId("CodeLabel");
codeLabel.textProperty().bind(new StringBinding() {
{ bind(splineEditorControl.controlPoint1xProperty(),
splineEditorControl.controlPoint1yProperty(),
splineEditorControl.controlPoint2xProperty(),
splineEditorControl.controlPoint2yProperty()); }
@Override protected String computeValue() {
return String.format("Interpolator.SPLINE(%.4f, %.4f, %.4f, %.4f);",
splineEditorControl.getControlPoint1x(),
splineEditorControl.getControlPoint1y(),
splineEditorControl.getControlPoint2x(),
splineEditorControl.getControlPoint2y());
}
});
GridPane.setConstraints(codeLabel, 0, 10, 1, 1
, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
Button copyButton = new Button("Copy Code");
copyButton.getStyleClass().add("big-button");
copyButton.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent t) {
Clipboard.getSystemClipboard().setContent(
Collections.singletonMap(DataFormat.PLAIN_TEXT,(Object)codeLabel.getText()));
}
});
GridPane.setConstraints(copyButton, 1, 10, 1, 1
, HPos.CENTER, VPos.CENTER, Priority.NEVER, Priority.NEVER);
// preview
Label previewLabel = new Label("Animation Preview");
previewLabel.setStyle("-fx-font-weight: bold; -fx-font-size: 1.1em;");
GridPane.setConstraints(previewLabel, 1, 0, 1, 1, HPos.CENTER, VPos.CENTER);
// scale
Label scaleLabel = new Label("Scale");
GridPane.setConstraints(scaleLabel, 1, 1, 1, 1, HPos.CENTER, VPos.CENTER);
GridPane.setConstraints(scaleCircle, 1, 2, 1, 1, HPos.CENTER, VPos.CENTER);
// rotate
Label rotateLabel = new Label("Rotate");
GridPane.setConstraints(rotateLabel, 1, 3, 1, 1, HPos.CENTER, VPos.CENTER);
GridPane.setConstraints(rotateSquare, 1, 4, 1, 1, HPos.CENTER, VPos.CENTER);
// fade
Label fadeLabel = new Label("Fade");
GridPane.setConstraints(fadeLabel, 1, 5, 1, 1, HPos.CENTER, VPos.CENTER);
GridPane.setConstraints(fadeSquare, 1, 6, 1, 1, HPos.CENTER, VPos.CENTER);
// linear
Label linearLabel = new Label("Linear");
GridPane.setConstraints(linearLabel, 1, 7, 1, 1, HPos.CENTER, VPos.CENTER);
GridPane.setConstraints(linearGroup, 1, 8, 1, 1, HPos.CENTER, VPos.CENTER);
getColumnConstraints().addAll(
new ColumnConstraints(300,USE_COMPUTED_SIZE,Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER,true),