Press "Enter" to skip to content

Show clock code of resturant management system.

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

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

}

Interface of after run the home page.

Be First to Comment

Leave a Reply

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