问答题
  注意:不改变程序的结构,不得增行或删行。
  import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;
  public class advance extends JFrame
  {
   private JLabel actionlnfo;
   public advance(String titleText)
   {
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     super(titleText);
     actionInfo=new JLabel("事件信息");
     JToolBar tb=new JTooBar();
     Menu file=new Menu( "文件" );
     JMenuBar mb=new JMenuBar();
     mb.add(file);
     NewAction na=new NewAction(actionInfo);
     file.add(na);
     tb.add(na);
     SaveAction sa=new SaveAction(actionInfo);
     file.add(sa);
     tb.add(sa);
     PrintAction pta=new PrintAction(actionInfo);
     file.add(pra);
     tb.add(pra);
     PageSetAction psa=new PageSetAction(actionInfo);
     file.add(psa);
     tb.add(psa);
     ExitAction ea=new ExitAction(actionInfo);
     file.add(ea);
     tb.add(ea);
     setJMenuBar(mb);
     Container cp=getContentPane();
     cp.setLayout(new BorderLayout());
     cp.add(tb);
     cp.add(actionInfo, BorderLayout.CENTER );
     setSize(350, 200);
     setVisible(true);
   }
   public static void main(String[] args)
   {
     new advance("advance");
   }
  }
  class NewAction extends AbstractAction
  {
   JLabel label;
   public NewAction(JLabel label)
   {
     super("新建");
     this.label=label;
   }
   public void actionPerformed(ActionEvent e)
   {
     label.setText("您选择了新建");
   }
  }
  class SaveAction extends AbstractAction
  {
   JLabel label;
   public SaveAction(JLabel label)
   {
   super("保存");
   this.label=label;
   }
   public void actionPerformed(ActionEvent e)
   {
   label.setText ("您选择了保存");
   }
  }
  class printAction extends AbstractAction
  {
   JLabel label;
   public PrintAction(JLabel label)
   {
     super("打印");
     this.label=label;
   }
   public void actionPerformed(ActionEvent e)
   {
   label.setText ("您选择了打印");
   }
  }
  class PageSetAction extends AbstractAction
  {
   JLabel label;
   public pageSetAction(JLabel label)
   {
     super("页面设置");
     this.label=label;
   }
   public void actionPerformed(ActionEvent e)
   {
     label.setText("您选择了页面设置");
   }
  }
  class ExitAction extends AbstractAction
  {
   JLabel label;
   public ExitAction(JLabel label)
   {
     super("退出");
     this.label=label;
   }
 public void actionPerformed(ActionEvent e)
 {
   label.setText ("您选择了退出");
 }
}