Java Reference
In-Depth Information
labelStageW = new Label();
labelStageH = new Label();
FlowPane sceneRoot = new FlowPane(Orientation.VERTICAL, 20, 10, hbox,
textSceneX, textSceneY, textSceneW, textSceneH, hyperlink,
radio1, radio2,
labelStageX, labelStageY,
labelStageW,
labelStageH);
sceneRoot.setPadding(new Insets(0, 20, 40, 0));
sceneRoot.setColumnHalignment(HPos.LEFT);
sceneRoot.setLayoutX(20);
sceneRoot.setLayoutY(40);
sceneRef = new Scene(sceneRoot, 600, 250);
sceneRef.getStylesheets().add("onTheScene.css");
stage.setScene(sceneRef);
choiceBoxRef.getSelectionModel().selectFirst();
// Setup various property binding
textSceneX.textProperty().bind(new SimpleStringProperty("Scene x: ")
.concat(sceneRef.xProperty().asString()));
textSceneY.textProperty().bind(new SimpleStringProperty("Scene y: ")
.concat(sceneRef.yProperty().asString()));
textSceneW.textProperty().bind(new SimpleStringProperty("Scene width: ")
.concat(sceneRef.widthProperty().asString()));
textSceneH.textProperty().bind(new SimpleStringProperty("Scene height: ")
.concat(sceneRef.heightProperty().asString()));
labelStageX.textProperty().bind(new SimpleStringProperty("Stage x: ")
.concat(sceneRef.getWindow().xProperty().asString()));
labelStageY.textProperty().bind(new SimpleStringProperty("Stage y: ")
.concat(sceneRef.getWindow().yProperty().asString()));
labelStageW.textProperty().bind(new SimpleStringProperty("Stage width: ")
.concat(sceneRef.getWindow().widthProperty().asString()));
labelStageH.textProperty().bind(new SimpleStringProperty("Stage height: ")
.concat(sceneRef.getWindow().heightProperty().asString()));
sceneRef.cursorProperty().bind(choiceBoxRef.getSelectionModel()
.selectedItemProperty());
fillVals.bind(sliderRef.valueProperty());
// When fillVals changes, use that value as the RGB to fill the scene
fillVals.addListener((ov, oldValue, newValue) -> {
Double fillValue = fillVals.getValue() / 256.0;
sceneRef.setFill(new Color(fillValue, fillValue, fillValue, 1.0));
});
Search WWH ::




Custom Search