@Override public void invalidated(Observable ignored) { if (Double.isNaN(dialog.getWidth()) || Double.isNaN(dialog.getHeight())) { return; } dialog.widthProperty().removeListener(positionAdjuster); dialog.heightProperty().removeListener(positionAdjuster); fixPosition(); } };
public void show() { dialog.setOpacity(0); // pickerDecorator.setOpacity(0); if (dialog.getOwner() != null) { dialog.widthProperty().addListener(positionAdjuster); dialog.heightProperty().addListener(positionAdjuster); positionAdjuster.invalidated(null); } if (dialog.getScene() == null) { dialog.setScene(customScene); } curvedColorPicker.preAnimate(); dialog.show(); if (initOnce) { initRun.run(); initOnce = false; } Timeline timeline = new Timeline(new KeyFrame(Duration.millis(120), new KeyValue(dialog.opacityProperty(), 1, Interpolator.EASE_BOTH))); timeline.setOnFinished((finish) -> curvedColorPicker.animate()); timeline.play(); }
/** * add a size listener for the given stage * * @param stage */ public void addSizeListener(Stage stage) { this.addSizeListener(stage.widthProperty(), stage.heightProperty()); }
@Override public void invalidated(Observable ignored) { if (Double.isNaN(dialog.getWidth()) || Double.isNaN(dialog.getHeight())) { return; } dialog.widthProperty().removeListener(positionAdjuster); dialog.heightProperty().removeListener(positionAdjuster); fixPosition(); } };
import javafx.application.Application; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.TableView; import javafx.stage.Stage; public class MCVE extends Application { @Override public void start(Stage stage) { TableView<ObservableList<String>> table = new TableView<ObservableList<String>>(); // We bind the prefHeight- and prefWidthProperty to the height and width of the stage. table.prefHeightProperty().bind(stage.heightProperty()); table.prefWidthProperty().bind(stage.widthProperty()); stage.setScene(new Scene(table, 400, 400)); stage.show(); } public static void main(String[] args) { launch(); } }
primaryStage.heightProperty().addListener(listener);
primaryStage.xProperty(), primaryStage.yProperty(), primaryStage.widthProperty(), primaryStage.heightProperty());
scene.heightProperty(), primaryStage.widthProperty(), primaryStage.heightProperty() );
return new ObjectBinding<Dimension2D>() { bind(stage.widthProperty(), stage.heightProperty()); return new Dimension2D(stage.widthProperty().doubleValue(), stage.heightProperty().doubleValue());
return new ObjectBinding<Dimension2D>() { bind(stage.widthProperty(), stage.heightProperty()); return new Dimension2D(stage.widthProperty().doubleValue(), stage.heightProperty().doubleValue());
primaryStage.heightProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> arg0, Number arg1, Number arg2) {
primaryStage.yProperty().addListener(boundsListener); primaryStage.widthProperty().addListener(boundsListener); primaryStage.heightProperty().addListener(boundsListener); primaryStage.show();
/** * setup the xyTabPane and it's behavior */ public void setupXyTabPane() { // add the xyTabPane getRoot().getChildren().add(xyTabPane); // make sure it shrinks and grows with the scene NumberBinding heightAdjust = getStage().heightProperty() .add(menuBar.heightProperty()); xyTabPane.getvTabPane().prefHeightProperty() .bind(heightAdjust.add(-xyTabPane.getTabSize())); xyTabPane.getvTabPane().prefWidthProperty() .bind(getStage().widthProperty().add(0)); // -xyTabPane.getTabSize() }
blockingRect.heightProperty().bind(primaryStage.heightProperty()); blockingRect.setFill(Color.LIGHTBLUE); blockingRect.setOpacity(0.5);
imageView.fitHeightProperty().bind(stage.heightProperty()); imageView.setPreserveRatio(true);
public void show() { dialog.setOpacity(0); // pickerDecorator.setOpacity(0); if (dialog.getOwner() != null) { dialog.widthProperty().addListener(positionAdjuster); dialog.heightProperty().addListener(positionAdjuster); positionAdjuster.invalidated(null); } if (dialog.getScene() == null) { dialog.setScene(customScene); } curvedColorPicker.preAnimate(); dialog.show(); if (initOnce) { initRun.run(); initOnce = false; } Timeline timeline = new Timeline(new KeyFrame(Duration.millis(120), new KeyValue(dialog.opacityProperty(), 1, Interpolator.EASE_BOTH))); timeline.setOnFinished((finish) -> curvedColorPicker.animate()); timeline.play(); }
y.bind(ViewStructure.primaryStage().yProperty().add(ViewStructure.primaryStage().heightProperty().subtract(dialogStage.heightProperty()).divide(3)));
y.bind(ViewStructure.primaryStage().yProperty().add(ViewStructure.primaryStage().heightProperty().subtract(dialogStage.heightProperty()).divide(3)));