1
After researching several posts referring to the subject, I did not find an example where I create an "external" class (other than the main one for example) and main call the method that gives me the updated time automatically.
I have used the following way to retrieve date/time
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(() -> {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
String sDataHora = sdf.format(new Date());
jDataHora.setText(sDataHora);
}, 1, 1, TimeUnit.SECONDS);