title: Create one date time java class and access it on all Jframes
body: <p>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?</p>
  
  <p>I tried this code to do it.</p>
  
  <p>Testing Code......</p>
  
  <pre><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 ();
  </code></pre>
  
  <p>I want to access this time variable or whatever Methodist to show time on all Frames using this timer.</p>