/* * This class represents what we want to put on a Window. * For now we are just indicating that the class MouseHandler * will take care of Mouse events. */ import java.awt.event.*; import java.awt.*; import java.awt.event.ActionEvent; import javax.swing.*; public class MyPanel extends JPanel implements ActionListener { private final static int NUMBER_OF_BUTTONS = 3; private JButton[] buttons; private JTextArea textArea; private RequestProcessor processor; private int textAreaHeight; private int textAreaWidth; public MyPanel(RequestProcessor processor, int frameWidth, int frameHeight) { textAreaWidth = frameWidth / 12; textAreaHeight = frameHeight /32; drawGUI(); addThisClassAsListener(); /* Setting a reference to the object that will actually */ /* process the requests generated by the selection of */ /* a buttonn */ this.processor = processor; } /* Allow us to write to the text area (display) */ private void writeToDisplay(String text) { textArea.setText(text); } /* This method defines the current object as the one that */ /* will take care of handling the processing associated */ /* with selecting a button */ private void addThisClassAsListener() { for (int i=0; i