I want to create one date and time class for show date and time on all frames (My Swing Application). It means though number of frames are create i want display date and time using created java class.so what is the best way to do it?
I tried this code to do it.
Testing Code......
final SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss a");
Timer timer = new javax.swing.Timer(1000, new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
        Date date = new Date();
        String time = df.format(date);
    }
});
timer.start ();
I want to access this time variable or whatever Methodist to show time on all Frames using this timer.
 
     
    