/**
* 定义菜单栏,菜单、设置、退出
*/
JMenuBar menuBar = new JMenuBar();
JMenu mnuPhoto = new JMenu();
JMenuItem mnuiSet = new JMenuItem();
JMenuItem mnuiExit = new JMenuItem();
//加载菜单栏
this.loadMenu();
this.setJMenuBar(menuBar);
/**
* 加载菜单栏
*/
private void loadMenu()
{
mnuPhoto.setText("菜单");
mnuiSet.setText("设置");
mnuiExit.setText("退出");
menuBar.add(mnuPhoto);
mnuPhoto.add(mnuiSet);
mnuPhoto.add(mnuiExit);
mnuiSet.addActionListener(this);
mnuiExit.addActionListener(this);
}
* 定义菜单栏,菜单、设置、退出
*/
JMenuBar menuBar = new JMenuBar();
JMenu mnuPhoto = new JMenu();
JMenuItem mnuiSet = new JMenuItem();
JMenuItem mnuiExit = new JMenuItem();
//加载菜单栏
this.loadMenu();
this.setJMenuBar(menuBar);
/**
* 加载菜单栏
*/
private void loadMenu()
{
mnuPhoto.setText("菜单");
mnuiSet.setText("设置");
mnuiExit.setText("退出");
menuBar.add(mnuPhoto);
mnuPhoto.add(mnuiSet);
mnuPhoto.add(mnuiExit);
mnuiSet.addActionListener(this);
mnuiExit.addActionListener(this);
}