jsxww2002
发贴: 18
积分: 0
|
于 2005-03-08 14:47
有没有高手帮忙啊,关键的不分我不会写????????? import java.awt.*; import java.awt.event.*; public class ceshi { public static void main(String[] args) { MenuFrame form = new MenuFrame(); form.setVisible(true); } } class MenuFrame extends Frame implements ActionListener { MenuBar m_MenuBar=new MenuBar(); Menu menuFile = new Menu("文件"); MenuItem f1 = new MenuItem("添加图片"); MenuItem f2 = new MenuItem("退出"); MenuFrame() { super("实验"); setLayout(new FlowLayout()); m_MenuBar.add(menuFile); menuFile.add(f1); f1.addActionListener(this); menuFile.add(f2); f2.addActionListener(this); setMenuBar(m_MenuBar); setSize(200,300); addWindowListener(new Tuichu()); } public void actionPerformed(ActionEvent e) { if(e.getActionCommand()=="添加图片") { } if(e.getActionCommand()=="退出") { System.exit(0); } } } class Tuichu extends WindowAdapter { public void windowClosing(WindowEvent e) { System.exit(0); } }
|