title: Timer Listener Class number error
body: <p>im getting an error in my timer listener class , I was hoping if someone could take a look, and explain what is wrong with it. Im getting an error when I add numbers+1. Also It appears the stop button isnt working.</p>
  
  <pre><code> public class Main
  {
  
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args)
  {
      JFrame frame = new JFrame("Odometer Program");
      frame.setLayout(new FlowLayout());
      // Creates Frame and a array of textfields
      JTextField[] tf1 = new JTextField[3];
      JPanel northPanel = new JPanel();
  
      for (int i = 0; i &lt; tf1.length; i++) // adds texfields to frame
      {
          tf1[i] = new JTextField(1);
          northPanel.add(tf1[i]);
      }
      JButton DriveButton = new JButton(" Drive Car");
      JButton StopButton = new JButton("Stop Car");
      JPanel SouthPanel = new JPanel();
      SouthPanel.add(DriveButton);
      SouthPanel.add(StopButton);
  
      frame.add(northPanel, BorderLayout.NORTH);
      frame.add(SouthPanel, BorderLayout.SOUTH);
      frame.pack();  // sets default seize and width to the frame
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
  
      //  Create the timer
      ActionListener timerListener = new TimerListener(tf1);
      Timer timer = new Timer(100, timerListener);// 100 for tenth of a second
      timer.start();
  
      // create Action Listener for two buttons
      ActionListener buttonListener = new DrivecarStopcarListener(timer);
      DriveButton.addActionListener(buttonListener);
      StopButton.addActionListener(buttonListener);
      StopButton.setActionCommand("Stop Car");
      DriveButton.setActionCommand("Drive Car");
      }
  
  }
  
  class TimerListener implements ActionListener
  </code></pre>
  
  <p>{</p>
  
  <pre><code>private int[] numbers; // array of numbers
  private JTextField[] textFields;
  
  TimerListener(JTextField[] tf1)  // copy position into constructor
  {
      // copy array to text fields
      textFields = tf1;
  
      // new int to create integers, the same size of text fields
      numbers = new int[textFields.length];
  
      for (int pos = 0; pos &lt; numbers.length; pos++) //
      {
          textFields[pos].setText(String.valueOf(numbers[pos]));
          numbers + 1;
      }
  
  }
  
  @Override
  public void actionPerformed(ActionEvent ae)
  {
      for (int pos = 0; pos &lt; numbers.length; pos++)
      {
          textFields[pos].setText(String.valueOf(numbers[pos]));
          numbers + 1;
      }
  
  }
  }
  
  class DrivecarStopcarListener implements ActionListener
  {
  
  private Timer myTimer;
  
  DrivecarStopcarListener(Timer t)
  {
      myTimer = t;
  }
  
  @Override
  public void actionPerformed(ActionEvent ae)
  {
      String action = ae.getActionCommand();
      switch (action)
      {
          case "Drive car":
              myTimer.start();
              break;
          case "Stop car":
              myTimer.stop();
              break;
          }
  }
  }
  </code></pre>