package edu.pdx.cs410G.swing;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import javax.swing.*;

/**
 * This program demonstrates a Swing {@link Timer} that periodically
 * updates a {@link JTextField} with the current time.
 */
public class TimerExample extends JPanel {

  public TimerExample() {
    this.setLayout(new BorderLayout());
    final JTextField text = new JTextField(20);
    text.setEditable(false);
    this.add(BorderLayout.CENTER, text);
    
    ActionListener listener = new ActionListener() {
	public void actionPerformed(ActionEvent e) {
	  text.setText(new Date().toString());
	}
      };
    Timer timer = new Timer(1000, listener);
    timer.setInitialDelay(0);
    timer.start();
  }

  public static void main(String[] args) {
    JFrame frame = new JFrame("A Timer");
    JPanel panel = new TimerExample();
    frame.getContentPane().add(panel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
  }

}

@@ -349,16 +349,46 @@
 anel %7B%0A%0A
+  private final Timer timer;%0A%0A
   public
@@ -723,22 +723,21 @@
  %7D;%0A    
-Timer 
+this.
 timer = 
@@ -763,24 +763,29 @@
 tener);%0A    
+this.
 timer.setIni
@@ -802,27 +802,8 @@
 0);%0A
-    timer.start();%0A
   %7D%0A
@@ -896,20 +896,28 @@
     
-JPanel panel
+TimerExample example
  = n
@@ -970,13 +970,15 @@
 add(
-panel
+example
 );%0A 
@@ -1079,16 +1079,84 @@
 e(true);
+%0A%0A    // Start timer after GUI is visible%0A    example.timer.start();
 %0A  %7D%0A%0A%7D%0A

Make sure to start the timer after you display the GUI. Otherwise you'll get a blocked thread.