@Override public void start(Stage primaryStage) throws Exception { Button okBtn = new Button(Msg.get(this, "ok")); Button cancelBtn = new Button(Msg.get(this, "cancel")); // Set the location of the OK button okBtn.setLayoutX(10); cancelBtn.setLayoutY(10); // Set the location of the Cancel button relative to the OK button NumberBinding layoutXBinding = okBtn.layoutXProperty().add(okBtn.widthProperty().add(10)); cancelBtn.layoutXProperty().bind(layoutXBinding); // cancelBtn.layoutYProperty().bind(okBtn.layoutYProperty()); // Group root = new Group(); root.getChildren().addAll(okBtn, cancelBtn); // Scene scene = new Scene(root); primaryStage.setScene(scene); primaryStage.setTitle(Msg.get(this, "title")); primaryStage.show(); }
@Override public void initialize(URL location, ResourceBundle resources) { super.initialize(location, resources); wrap_pane = new HBox(); group.getChildren().add(wrap_pane); GroupHeightBinding_Local groupH = new GroupHeightBinding_Local(group); GroupWidthBinding_Local groupW = new GroupWidthBinding_Local(group); ScrollPaneViewPortHeightBinding scrollH = new ScrollPaneViewPortHeightBinding(scroll_pane); ScrollPaneViewPortWidthBinding scrollW = new ScrollPaneViewPortWidthBinding(scroll_pane); button_clear .layoutYProperty() .bind( scroll_pane .vvalueProperty() .multiply(groupH.subtract(scrollH)) .add(scrollH.subtract(30))); button_clear .layoutXProperty() .bind(scroll_pane.hvalueProperty().multiply(groupW.subtract(scrollW)).add(10)); }