COMP2396
Loading...
Searching...
No Matches
SimpleMenu Class Reference
Inheritance diagram for SimpleMenu:
Collaboration diagram for SimpleMenu:

Public Member Functions

void actionPerformed (ActionEvent event)
 
void go ()
 

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Definition at line 4 of file SimpleMenu.java.

Member Function Documentation

◆ actionPerformed()

void SimpleMenu.actionPerformed ( ActionEvent event)
inline

Definition at line 39 of file SimpleMenu.java.

39 {
40 text.append("Menu item selected\n");
41 }

◆ go()

void SimpleMenu.go ( )
inline

Definition at line 12 of file SimpleMenu.java.

12 {
13 JFrame frame = new JFrame();
14 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
15
16 JMenuBar menuBar = new JMenuBar();
17 JMenu menu = new JMenu("Menu A");
18
19 JMenuItem menuItem = new JMenuItem("Item");
20 menuItem.addActionListener(this);
21 menu.add(menuItem);
22 menuBar.add(menu);
23 frame.setJMenuBar(menuBar);
24
25 text = new JTextArea();
26 text.setLineWrap(true);
27
28 JScrollPane scroller = new JScrollPane(text);
29 scroller.setVerticalScrollBarPolicy(
30 ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
31 scroller.setHorizontalScrollBarPolicy(
32 ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
33 frame.add(scroller);
34
35 frame.setSize(350, 300);
36 frame.setVisible(true);
37 }

Referenced by main().

Here is the caller graph for this function:

◆ main()

static void SimpleMenu.main ( String[] args)
inlinestatic

Definition at line 7 of file SimpleMenu.java.

7 {
8 SimpleMenu simpleMenu = new SimpleMenu();
9 simpleMenu.go();
10 }

References go().

Here is the call graph for this function:

The documentation for this class was generated from the following file: