View Javadoc
1 // $Id: Menu.java,v 1.2 2004/02/12 22:59:36 powerpete Exp $
2 // [JMP, 09.02.2004] Created this file.
3 package org.jface.vega.menu;
4
5 import javax.swing.Action;
6 import javax.swing.JMenu;
7 import javax.swing.JMenuItem;
8
9 /***
10 * @author <a href="mailto:powerpete@users.sf.net">M. Petersen</a>
11 * @version $Id: Menu.java,v 1.2 2004/02/12 22:59:36 powerpete Exp $
12 */
13 public class Menu
14 {
15 private JMenu menu = new JMenu();
16 private boolean shouldNeedSeparator = false;
17
18 JMenu getMenu()
19 {
20 return menu;
21 }
22
23 public void setText(String text)
24 {
25 menu.setText(text);
26 }
27
28 public void addMenuItem(Action action)
29 {
30 menu.add(action);
31 shouldNeedSeparator = true;
32 }
33
34 public void addMenuItem(JMenuItem menuItem)
35 {
36 menu.add(menuItem);
37 shouldNeedSeparator = true;
38 }
39
40 public void addSeparator()
41 {
42 if (shouldNeedSeparator)
43 {
44 menu.addSeparator();
45 }
46 shouldNeedSeparator = false;
47 }
48 }
This page was automatically generated by Maven