title: Timer in JPanel
body: <p>I'm trying to create an application, and I would like to add a clock. I'm making the Clock using a JPanel and an ActionListener, and would also like to use a Timer. The Swing Tutorial says that to instantiate a Timer, you would say new Timer(numMillis, this(an ActionListener)), however, "this" doesn't seem to work with JPanel items. 
  What would I add to the Timer constructor to properly instantiate the Timer?</p>
  
  <pre><code>public ClockPanel() {
      super();
  
       clockLabel.setText(sdf.format(new Date(System.currentTimeMillis())));
       clockLabel.setFont(new Font("Monospaced", Font.BOLD, 100));
       clockLabel.setOpaque(true);
       clockLabel.setBackground(Color.black);
       clockLabel.setForeground(Color.white);
  
       timer = new Timer(500, this);
       timer.setRepeats(true);
       timer.start();
  
       clockLabel.setVisible(true);
  
      initComponents();
  }
  public void actionPerformed(ActionEvent e){
       if(e.getSource().equals(timer))
          clockLabel.setText(sdf.format(new Date(System.currentTimeMillis())));
    }
  </code></pre>