11 package com.google.scrollview.ui;
16 import java.awt.event.ActionEvent;
17 import java.awt.event.ActionListener;
18 import java.util.HashMap;
20 import javax.swing.JMenu;
21 import javax.swing.JMenuBar;
33 private JMenuBar root;
35 private HashMap<String, SVAbstractMenuItem> items;
45 root =
new JMenuBar();
46 svWindow = scrollView;
47 items =
new HashMap<String, SVAbstractMenuItem>();
48 svWindow.setJMenuBar(root);
58 SVAbstractMenuItem svm = items.get(e.getActionCommand());
73 public void add(String parent, String
name,
int id) {
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);
118 public void add(String parent, String
name,
int id,
boolean b) {
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);
SVMenuBar(SVWindow scrollView)
void add(String parent, String name, int id, boolean b)
void actionPerformed(ActionEvent e)
void add(String parent, String name, int id)