Hi im trying to make a external control trough buttons for becker.robots package.

But i have few problems even at this early stage when make a external panel i have to click the start button on the main window where the robot is otherwise the program crashes.
Im thinking of either remove the start stop button somehow or inserting my controls inside the robot panel, any ideas?

This is the code i have so far i know i have not made the control generic and it will only control the myRobot and the coding is dirty :-) but any suggestions are welcome.

Java Code:
package prototype;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import becker.robots.*;

public class Prototype
{
    
    static City myCity = new City(12, 10);
    
    static RobotSE myRobot = new RobotSE(myCity, 3, 3, Direction.SOUTH);
    public static void main(String[] args) 
    {
         
        
        SwingUtilities.invokeLater(new Runnable() 
        {  
            public void run() 
            {  
            new ControlPanel6();  
            }  
        });
    }
}
Java Code:
package prototype;

import java.awt.*;  
import java.awt.event.*;  
import javax.swing.*;   
   
class ControlPanel6 implements ActionListener {  
  
  JLabel jlab;     
  JButton jbtnStartStop; // a start or stop button 
  JButton jbtnTurn;
  ControlPanel6() {  
  
    // Create a new JFrame container.  
    JFrame jfrm = new JFrame("Control Panel");  
  
    // Specify FlowLayout for the layout manager.  
    jfrm.getContentPane().setLayout(new FlowLayout());  
  
    // Give the frame an initial size.  
    jfrm.setSize(230, 90);  
  
    // Terminate the program when the user closes the application.  
    jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
  
    // Make  buttons. 
    jbtnStartStop = new JButton("Start");  
    jbtnTurn = new JButton("Turn");
    
    // Add action listeners.  
    jbtnStartStop.addActionListener(this);  
    jbtnTurn.addActionListener(this);
    // Add the buttons to the content pane.  
    jfrm.getContentPane().add(jbtnStartStop);   
    jfrm.getContentPane().add(jbtnTurn);
    // Create a text-based label.  
    jlab = new JLabel("Robot Navigation");  
  
    // Add the label to the frame.  
    jfrm.getContentPane().add(jlab);  
  
    // Display the frame.  
    jfrm.setVisible(true);  
  }  
  
  // Handle button events.  
  public void actionPerformed(ActionEvent ae) {    
  
    if(ae.getActionCommand().equals("Start")) {  
       
      Prototype.myRobot.move(2);     
    }else if(ae.getActionCommand().equals("Turn"))
    { 
      Prototype.myRobot.turnRight();
       
       
    }else
    {
        System.out.println("Hello");
    }
  }
}