这个程序编译通过了.,,但运行不起啊呀,帮帮我吧. 源程序如下.是一个菜单方面的. import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; class event implements ActionListener { JFrame frame; JMenuBar mymenubar;JMenu menu1,menu2; JMenuItem item1,item2,item3,item4; JButton button1,button2; JTextArea text1,text2; JPanel panel1,panel2; CardLayout mycard; public void event() { frame=new JFrame("Menu"); Container con=frame.getContentPane(); con.setLayout(new BorderLayout()); mymenubar=new JMenuBar(); con.add(mymenubar,BorderLayout.NORTH); menu1=new JMenu("卡片选择"); menu1=new JMenu("系统维护"); item1=new JMenuItem("卡片1"); item2=new JMenuItem("卡片2"); item3=new JMenuItem("卡片3"); item4=new JMenuItem("帮助"); menu1.add(item1);menu1.add(item2);menu1.add(item3);menu2.add(item4); mymenubar.add(menu1);mymenubar.add(menu2); panel1=new JPanel();panel2=new JPanel(); con.add(panel1,BorderLayout.SOUTH); mycard=new CardLayout();
panel1.setLayout(mycard); text1=new JTextArea("第一张卡片"); text2=new JTextArea("第三张卡片"); button1=new JButton("确定"); button2=new JButton("取消"); panel2.add(button1);panel2.add(button2); panel1.add("第一张卡片",text1);panel1.add("第二张卡片",panel2); panel1.add("第三张卡片",text2); item1.addActionListener(this); item2.addActionListener(this); item3.addActionListener(this); frame.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {System.exit(0);}}); frame.pack(); frame.show(); } public void actionPerformed(ActionEvent e) {if(e.getSource()==item1) mycard.first(panel1); else if(e.getSource()==item2) { mycard.first(panel1); mycard.next(panel1);} else if(e.getSource()==item3) mycard.last(panel1); } } public class showmenu {public static void main(String args[]) {event kk=new event(); kk.event(); } }