MCPcopy Create free account
hub / github.com/DuGuQiuBai/Java / main

Method main

day25/code/day25_Frame/src/cn/itcast_07/MenuDemo.java:16–52  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

14 */
15public class MenuDemo {
16 public static void main(String[] args) {
17 // �����������
18 final Frame f = new Frame("һ���˵�");
19 // ��������
20 f.setBounds(500, 250, 400, 300);
21
22 // �����˵���
23 MenuBar mb = new MenuBar();
24 // �����˵�
25 Menu m = new Menu("�ļ�");
26 // �����˵���
27 MenuItem mi = new MenuItem("�˳�ϵͳ");
28
29 // �˵��������
30 m.add(mi);
31 mb.add(m);
32
33 // ���ӵ�����
34 f.setMenuBar(mb);
35
36 // ע���¼�
37 f.addWindowListener(new WindowAdapter() {
38 @Override
39 public void windowClosing(WindowEvent e) {
40 System.exit(0);
41 }
42 });
43
44 mi.addActionListener(new ActionListener() {
45 @Override
46 public void actionPerformed(ActionEvent e) {
47 System.exit(0);
48 }
49 });
50
51 f.setVisible(true);
52 }
53}

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected