javafx live date and time

Solutions on MaxInterview for javafx live date and time by the best coders in the world

showing results for - "javafx live date and time"
Ana Sofia
12 May 2017
1@FXML
2public void initialize() {
3
4    Timeline clock = new Timeline(new KeyFrame(Duration.ZERO, e -> {        
5        LocalTime currentTime = LocalTime.now();
6        time.setText(currentTime.getHour() + ":" + currentTime.getMinute() + ":" + currentTime.getSecond());
7    }),
8         new KeyFrame(Duration.seconds(1))
9    );
10    clock.setCycleCount(Animation.INDEFINITE);
11    clock.play();
12}
13