Import java.awt.menu;
Import java.awt.menubar;
Import java.awt.menuitem;
Import java.awt.menu shortcut;
Import java.awt.event.actionevent;
Import java.awt.event.actionlistener;
Import java.awt.event.keyevent;
Import java.awt.event.windowadapter;
Import java.awt.event.windowevent; The public class Test_ 1 1 extends the framework to realize ActionListener{ /**
* @param args
*/
Menu bar mb = null
Menu m = empty;
MenuItem mi = null public exam _ 1 1() {
this.setBounds( 100, 100,400,300);
this . set visible(true);
MB = new MenuBar();
M = new menu ("file");
mi = new MenuItem(" open ");
mi . set shortcut(new menu shortcut(key event。 VK _ O));
m . add(mi);
MB . add(m);
setMenuBar(MB);
mi . addactionlistener(this);
this . addwindowlistener(new window adapter(){
public void window closing(window event e){
system . exit(0);
}
});
} public static void main(String[]args){
// TODO automatically generated method stub
new Test _ 1 1();
} @ Overwrite
public void action performed(action event arg 0){
system . exit(0);
}}