Java Reference
In-Depth Information
if (rb != null) {
System.out.println(rb.getText() + " selected");
}
});
textField.textProperty().addListener((ov, oldValue, newValue) -> {
System.out.println("TextField text is: " + textField.getText());
});
passwordField.focusedProperty().addListener((ov, oldValue, newValue) -> {
if (!passwordField.isFocused()) {
System.out.println("PasswordField text is: "
+ passwordField.getText());
}
});
textArea.focusedProperty().addListener((ov, oldValue, newValue) -> {
if (!textArea.isFocused()) {
System.out.println("TextArea text is: " + textArea.getText());
}
});
slider.valueProperty().bindBidirectional(model.rpm);
progressIndicator.progressProperty().bind(model.rpm.divide(model.maxRpm));
scrollBar.valueProperty().bindBidirectional(model.kph);
progressBar.progressProperty().bind(model.kph.divide(model.maxKph));
choiceBox.getSelectionModel().selectFirst();
choiceBox.getSelectionModel().selectedItemProperty()
.addListener((observable, oldValue, newValue) -> {
System.out.println(newValue + " chosen in ChoiceBox");
});
ScrollPane scrollPane = new ScrollPane(variousControls);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
scrollPane.setOnMousePressed((MouseEvent me) -> {
if (me.getButton() == MouseButton.SECONDARY) {
contextMenu.show(stage, me.getScreenX(), me.getScreenY());
}
});
MenuItem contextA = new MenuItem("MenuItem A");
contextA.setOnAction(e -> System.out.println(e.getEventType()
+ " occurred on Menu Item A"));
MenuItem contextB = new MenuItem("MenuItem B");
contextMenu = new ContextMenu(contextA, contextB);
return scrollPane;
}
Search WWH ::




Custom Search