给该类实现 ActionListener接口并实现抽象方法:
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() instanceof JMenuItem) {
String arg = evt.getActionCommand();
if (arg.equals(".......")) {
                               XFrame a = new XFrame();
                               a.setVisible(true);
                           }
                  else if (........) {
                  }
            }