Java 类javafx.util.converter.LocalDateTimeStringConverter 实例源码

项目:JVx.javafx    文件:FXDateTimePickerTestMain.java   
@Override
public void start(Stage primaryStage)
{
    Label valueLabel = new Label("null");

    FXDateTimePicker dateTimePicker = new FXDateTimePicker();
    valueLabel.textProperty().bindBidirectional(dateTimePicker.valueProperty(), new LocalDateTimeStringConverter());

    FXDateTimeComboBox dateTimeComboBox = new FXDateTimeComboBox();
    dateTimeComboBox.valueProperty().bindBidirectional(dateTimePicker.valueProperty());

    FXFormPane root = new FXFormPane();
    root.addChild(dateTimePicker, root.createConstraint(0, 0, -1, -3));
    root.addChild(dateTimeComboBox, root.createConstraint(0, -2, -1, -2));
    root.addChild(new Label("Value: "), root.createConstraint(0, -1, 0, -1));
    root.addChild(valueLabel, root.createConstraint(1, -1, -1, -1));

    primaryStage.setScene(new Scene(root));
    primaryStage.setTitle("JavaFX FXDateTimePicker Test");
    primaryStage.show();

    dateTimePicker.setValue(LocalDateTime.now().withNano(0));
}