The SVMenuBar class provides the functionality to add a menubar to ScrollView. Each menubar item gets associated with a (client-defined) command-id, which SVMenuBar will return upon clicking it.
- Author
- wanke.nosp@m.@goo.nosp@m.gle.c.nosp@m.om
Definition at line 31 of file SVMenuBar.java.
com.google.scrollview.ui.SVMenuBar.SVMenuBar |
( |
SVWindow |
scrollView | ) |
|
|
inline |
Create a new SVMenuBar and place it at the top of the ScrollView window.
- Parameters
-
scrollView | The window our menubar belongs to. |
Definition at line 44 of file SVMenuBar.java.
45 root =
new JMenuBar();
46 svWindow = scrollView;
47 items =
new HashMap<String, SVAbstractMenuItem>();
48 svWindow.setJMenuBar(root);
void com.google.scrollview.ui.SVMenuBar.actionPerformed |
( |
ActionEvent |
e | ) |
|
|
inline |
A click on one of the items in our menubar has occured. Forward it to the item itself to let it decide what happens.
Definition at line 56 of file SVMenuBar.java.
58 SVAbstractMenuItem svm = items.get(e.getActionCommand());
void com.google.scrollview.ui.SVMenuBar.add |
( |
String |
parent, |
|
|
String |
name, |
|
|
int |
id |
|
) |
| |
|
inline |
Add a new entry to the menubar.
- Parameters
-
parent | The menu we add our new entry to (should have been defined before). If the parent is "", we will add the entry to the root (top-level) |
name | The caption of the new entry. |
id | The Id of the new entry. If it is -1, the entry will be treated as a menu. |
Definition at line 73 of file SVMenuBar.java.
75 if (items.get(
name) != null) {
return; }
77 if (parent.equals(
"")) {
78 JMenu jli =
new JMenu(
name);
79 SVAbstractMenuItem mli =
new SVSubMenuItem(
name, jli);
85 SVAbstractMenuItem jmi = items.get(parent);
86 JMenu jli =
new JMenu(
name);
87 SVAbstractMenuItem mli =
new SVSubMenuItem(
name, jli);
93 SVAbstractMenuItem jmi = items.get(parent);
95 System.out.println(
"ERROR: Unknown parent " + parent);
98 SVAbstractMenuItem mli =
new SVEmptyMenuItem(
id,
name);
99 mli.mi.addActionListener(
this);
100 items.put(
name, mli);
void com.google.scrollview.ui.SVMenuBar.add |
( |
String |
parent, |
|
|
String |
name, |
|
|
int |
id, |
|
|
boolean |
b |
|
) |
| |
|
inline |
Add a new checkbox entry to the menubar.
- Parameters
-
parent | The menu we add our new entry to (should have been defined before). If the parent is "", we will add the entry to the root (top-level) |
name | The caption of the new entry. |
id | The Id of the new entry. If it is -1, the entry will be treated as a menu. |
b | Whether the entry is initally flagged. |
Definition at line 118 of file SVMenuBar.java.
119 SVAbstractMenuItem jmi = items.get(parent);
121 System.out.println(
"ERROR: Unknown parent " + parent);
124 SVAbstractMenuItem mli =
new SVCheckboxMenuItem(
id,
name, b);
125 mli.mi.addActionListener(
this);
126 items.put(
name, mli);
The documentation for this class was generated from the following file: