use of jgnash.uifx.control.DatePickerEx in project jgnash by ccavanaugh.
the class ControlsTest method start.
@Override
public void start(final Stage primaryStage) throws Exception {
Engine engine = createEngine();
Objects.requireNonNull(engine);
ThemeManager.restoreLastUsedTheme();
DecimalTextField decimalTextField = new DecimalTextField();
DecimalTextField decimalTextField2 = new DecimalTextField();
decimalTextField2.scaleProperty().set(4);
primaryStage.setTitle("Controls Test");
Button btn = new Button();
btn.setText("getDecimal()");
// Create the DatePicker.
DatePicker datePicker = new DatePickerEx();
datePicker.setOnAction(event -> {
LocalDate date = datePicker.getValue();
System.out.println("Selected date: " + date);
});
decimalTextField.decimalProperty().addListener((observable, oldValue, newValue) -> System.out.println("decimalTextField: " + newValue));
decimalTextField2.decimalProperty().addListener((observable, oldValue, newValue) -> System.out.println("decimalTextField2: " + newValue));
ObjectProperty<BigDecimal> decimal = new SimpleObjectProperty<>();
decimalTextField2.decimalProperty().bindBidirectional(decimal);
decimal.set(BigDecimal.TEN);
btn.setOnAction(event -> {
decimal.set(BigDecimal.ONE);
System.out.println(decimalTextField2.getDecimal());
});
System.out.println(decimal.isBound());
System.out.println(decimalTextField2.decimalProperty().isBound());
TransactionNumberComboBox numberComboBox = new TransactionNumberComboBox();
numberComboBox.accountProperty().set(engine.getAccountList().get(0));
Button exceptionButton = new Button("Show Exception");
exceptionButton.setOnAction(event -> StaticUIMethods.displayException(new Exception("Test exception")));
SecurityComboBox securityComboBox = new SecurityComboBox();
TextFieldEx textFieldEx = new TextFieldEx();
PopOverButton popOverButton = new PopOverButton(new FontAwesomeLabel(FontAwesomeLabel.FAIcon.EXCHANGE));
popOverButton.setContentNode(new DecimalTextField());
VBox vBox = new VBox();
vBox.getChildren().addAll(decimalTextField, decimalTextField2, datePicker, new AccountComboBox(), numberComboBox, btn, exceptionButton, securityComboBox, new TimePeriodComboBox(), textFieldEx, popOverButton);
primaryStage.setScene(new Scene(vBox, 300, 420));
primaryStage.getScene().getStylesheets().add(MainView.DEFAULT_CSS);
primaryStage.getScene().getRoot().getStyleClass().addAll("form", "dialog");
primaryStage.show();
primaryStage.requestFocus();
}
Aggregations