Search
 
SCRIPT & CODE EXAMPLE
 

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();
}
Comment

javafx live time and date

@FXML
public void initialize() {

    Timeline clock = new Timeline(new KeyFrame(Duration.ZERO, e ->  
         time.setText(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
    ),
         new KeyFrame(Duration.seconds(1))
    );
    clock.setCycleCount(Animation.INDEFINITE);
    clock.play();
}
Comment

PREVIOUS NEXT
Code Example
Java :: ubuntu java compiler version 
Java :: A horizontal line must be drawn through the diamond, centered vertically. • The message must be printed just above the line. • The message must be horizontally centered within the applet 
Java :: hot to grand achievemnt to player spigot 
Java :: complicated average java code 
Java :: how to set lowered bezels in jlabel 
Java :: convert long to date in java 
Java :: spigot heal player 
Java :: zpool 
Java :: wat is voorbereiden voltooid deelwoord 
Java :: java joptionpane input 
Java :: turn off focus border java 
Java :: how to convert int to string java 
Java :: java get size of jframe 
Java :: method to check parameters in java 
Java :: how to delete a file in java 
Java :: how Resolve FragmentManager fm =getActivity().getSupportFragmentManager(); 
Java :: Java get list of keys Hashmap 
Java :: java swing absolute position 
Java :: frequency of number in java using hashmap using getordefault 
Java :: closest fraction to pi 
Java :: spring get bean with generic type 
Java :: java compare two lists ignore case 
Java :: java import set and hashset 
Java :: primefaces datepicker custom validation 
Java :: JAVA_HOME is not defined correctly. 
Java :: change text color in joptionpane 
Java :: Unable to find bundled Java version. 
Java :: java load .json file 
Java :: how to find the highest power of 2 that divides a number? 
Java :: android studio remove notification bar 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =