01: package net.xoetrope.swing;
02:
03: import javax.swing.JMenu;
04: import javax.swing.JMenuItem;
05:
06: import net.xoetrope.xui.XAppender;
07: import net.xoetrope.xui.XTextHolder;
08: import java.awt.Font;
09:
10: /**
11: * A wrapper for menus
12: * <p>Copyright (c) Xoetrope Ltd., 1998-2004<br>
13: * @version 1.0
14: */
15: public class XMenu extends JMenu implements XTextHolder, XAppender {
16: public static Font defaultFont = new Font("Arial", Font.PLAIN, 10);
17:
18: public XMenu() {
19: super ();
20: setFont(defaultFont);
21: }
22:
23: /**
24: * Do any final setup needed
25: */
26: public void setup() {
27: }
28:
29: /**
30: * Appends the object o to this item
31: * @param o the appended item
32: * @param name
33: */
34: public void append(Object o, String name) {
35: if (o != null) {
36: ((JMenuItem) o).setName(name);
37: super .add((JMenuItem) o);
38: } else
39: addSeparator();
40: }
41:
42: /**
43: * Get a child object by name
44: * @param name
45: * @return the child
46: */
47: public Object getObject(String name) {
48: return null;
49: }
50: }
|