title: Button Listener for stoping and reversing an object (GUI)
body: <p>I have created two classes called ControlPanel and Bicycle Panel. They both run using a Japplet(GUI). The Bicycle Class creates a Bike one blue and one red. The control panel sets the display and creates the buttons. The buttons are there for the user to tell the bike to move, reverse, and stop. I display works correctly but I have trouble with the moving,stopping and reversing. When the program is first executed the bike starts moving automatically. However, my buttons dont work when I tell it to stop or reverse. I need some help on what I can change on my code to make it work or what am I missing. There is also a slider to change speed of bikes. </p>
  
  <p>ControlPanel - </p>
  
  <pre><code> import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;
  import javax.swing.event.*;
  
   public class ControlPanel extends JPanel
   {
  //1, blueBikeDelay;
  
  
  
  //The constructor creates 6 buttons, 2 sliders, and 2 bicycle panels
  //and organize them using layouts.
  public ControlPanel(int width, int height)
  {
      this.width = width;
      this.height = height;
  
      //
      JLabel = new JLabel("Red Delay");       
      JSlider = new JSlider(JSlider.VERTICAL);        
              add(sp);
  
      setPreferredSize(new Dimension(width,height));
  }
  
  
  private class ButtonListener implements ActionListener
  {
      public void actionPerformed(ActionEvent event)
      {.reverse();
      }
  } //end of ButtonListener
  
  private class SliderListener implements ChangeListener
  {
  </code></pre>