import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import javax.swing.JOptionPane;
import javax.swing.*;
import java.awt.*;
class time extends JFrame
{
private GregorianCalendar gcal;
private String timeformat;
private SimpleDateFormat formatter;
JLabel jlbl;
Font f;
public time()
{
Container c=getContentPane();
f=new Font("Times new Roman",Font.BOLD,50);
jlbl=new JLabel();
jlbl.setFont(f);
gcal=new GregorianCalendar();
timeformat="hh:mm:ss";
formatter=new SimpleDateFormat(timeformat);
gcal.add(Calendar.SECOND,1);
String timetxt=formatter.format(gcal.getTime());
c.add(jlbl);
if(jlbl!=null)
jlbl.setText(timetxt);
pack();
setVisible(true);
}
public static void main(String args[])
{
time t=new time();
}
}
No comments:
Post a Comment