javafx input box selection time

In JavaFX, you can use the DatePicker and TimePicker controls to select dates and times.

To select a date using the DatePicker control, you can use the following code:

DatePicker datePicker = new DatePicker();

To select a time using the TimePicker control, you can use the following code:

TimePicker timePicker = new TimePicker();

Then, add these controls to JavaFX's layout, or display them through the Stage.

For example, the following code demonstrates how to create a JavaFX window that contains a DatePicker and TimePicker controls:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.DatePicker;
import javafx.scene.control.TimePicker;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        DatePicker datePicker = new DatePicker();
        TimePicker timePicker = new TimePicker();

        VBox vbox = new VBox(da

Guess you like

Origin blog.csdn.net/m0_37649480/article/details/135363543