Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

javafx live date and time

@FXML
public void initialize() {

    Timeline clock = new Timeline(new KeyFrame(Duration.ZERO, e -> {        
        LocalTime currentTime = LocalTime.now();
        time.setText(currentTime.getHour() + ":" + currentTime.getMinute() + ":" + currentTime.getSecond());
    }),
         new KeyFrame(Duration.seconds(1))
    );
    clock.setCycleCount(Animation.INDEFINITE);
    clock.play();
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javafx #live #date #time
ADD COMMENT
Topic
Name
4+7 =