I want to implement a clock within my program to diusplay the date and time while the program is running. I have looked into the getCurrentTime() method and
getCurrentTime()
Timer timer = new Timer(1000, (ActionEvent e) -> { DateTimeFormatter myTime = DateTimeFormatter.ofPattern("HH:mm:ss"); LocalDateTime now = LocalDateTime.now(); jLabel1.setText(String.valueOf(myTime.format(now))); }); timer.setRepeats(true); timer.start();