Press "Enter" to skip to content

What is dynamic digital clock ?

A digital clock is a form of clock that presentations the time digitally (i.E. In numerals or other symbols), rather than an analog clock, where the time is indicated through the positions of rotating palms.

It is a dynamic clock and date that show on the home page.

I think this dynamic digital clock will be very helpful for every person

To get help you can see the video.

Source code for dynamic clock of the project.

1. Code of show jFrame in middle.

public void middle() {
setLocationRelativeTo(null);
}

2. Code of digital dynamic clock.

public void clock() {

Thread clock = new Thread() {
public void run() {
try {
for (;;) {
Calendar cal = new GregorianCalendar();
int day = cal.get(Calendar.DAY_OF_MONTH);
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
month = month + 1;

int second = cal.get(Calendar.SECOND);
int minute = cal.get(Calendar.MINUTE);
int hour = cal.get(Calendar.HOUR);

jLabel1.setText("Time: " + hour + ":" + minute + ":" + second + ", Date: " + day + "-" + month + "-" + year);

sleep(1000);
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
clock.start();

}

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *