title: JMenuItem action performed trouble
body: <p>I am having trouble implementing JMenuItem. I want my JMenuItem,"Pythagoras" in this case to make a tree, which means if a user clicks pythagoras, I want to make display a tree. I have a class called PythagorasTree which draws the tree. I am having difficulty connecting PythagorasTree class with JMenuItem. I am new in GUI. Any Help will be appreciated.</p>
  
  <pre><code>import java.awt.event.*;
  import javax.swing.*;
  
  public class MenuExp extends PythagorasTree{
  
      public static void main(String[] args) {
  
          JFrame frame = new JFrame("Computer Graphics HW");
          frame.setVisible(true);
          frame.setSize(400, 400);
          frame.pack();
  
          // Creating MenuBar
          JMenuBar menubar = new JMenuBar();
          frame.setJMenuBar(menubar);
  
          // Creating Menu
          JMenu file = new JMenu("File");
          menubar.add(file);
  
          //creating item inside File
          JMenuItem exit = new JMenuItem("Exit");
          file.add(exit);
  
          JMenuItem pythagoras = new JMenuItem("Pythagoras");
          file.add(pythagoras);
  
          class exitaction implements ActionListener {
              public void actionPerformed(ActionEvent e) {
                  System.exit(0);
              }
          }
          class pythagorasAction implements ActionListener {
              public void actionPerformed(ActionEvent e) {
                  /*
                   * Do something here
                   * 
                   */
              }
          }
          exit.addActionListener(new exitaction());
      }
  }
  </code></pre>