import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
class clock extends JFrame
{
int sec = 0;
int min = 0;
int hour = 0;
public clock(){
super("Clock");
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(90, 80);
setLocationRelativeTo(null);
setLayout(new FlowLayout());
JTextField fr = new JTextField(10);
fr.setFont(new Font("Serif",Font.BOLD,19));
fr.setEditable(false);
add(fr);
for(hour=1;hour<24;hour++)
{
for(min=0;min<60;min++)
{
for(sec=0;sec<60;sec++)
{
fr.setText(" "+hour+":"+ min+":"+sec);
try{Thread.sleep(1000);}
catch(Exception e){}
}
}
}
}
public static void main(String args[])
{
new clock();
}
}


0 comments: