package li;
import javax.swing.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
public class chuangkou {
public static void main(String args[]){
JFrame in = new JFrame("浏览器");
JMenuBar menubar = new JMenuBar();
in.setJMenuBar(menubar);
JMenu menu1 = new JMenu("文件(A)");
JMenu menu2 = new JMenu("编辑(B)");
JMenu menu3 = new JMenu("查看(C)");
menu1.setMnemonic('A');
menu2.setMnemonic('B');
menu3.setMnemonic('C');
menubar.add(menu1);
menubar.add(menu2);
menubar.add(menu3);
JMenu item1 = new JMenu("打开");
item1.setMnemonic('D');
JMenuItem item2 = new JMenuItem("保存");
JMenuItem item3 = new JMenuItem("复制");
JMenuItem item4 = new JMenuItem("停止");
JMenuItem item5 = new JMenuItem("刷新");
JMenuItem item6 = new JMenuItem("打开x");
JMenuItem item7 = new JMenuItem("打开y");
item2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E,InputEvent.CTRL_MASK));
item3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F,InputEvent.CTRL_MASK));
item4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G,InputEvent.CTRL_MASK));
item5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H,InputEvent.CTRL_MASK));
item6.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I,InputEvent.CTRL_MASK));
item7.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J,InputEvent.CTRL_MASK));
menu2.add(item3);
menu3.add(item4);
menu3.add(item5);
item1.add(item6);
item1.add(item7);
menu1.add(item1);
menu1.add(item2);
in.setSize(400,300);
in.setLocation(150,150);
in.setVisible(true);
in.validate();
in.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
}