01: package net.xoetrope.awt;
02:
03: import java.awt.Menu;
04: import java.awt.MenuItem;
05:
06: import net.xoetrope.xui.XAppender;
07: import net.xoetrope.xui.XTextHolder;
08:
09: /**
10: * A wrapper for menus
11: * <p>Copyright: Copyright (c) Xoetrope Ltd., 2002-2003</p>
12: * @version $Revision: 1.6 $
13: */
14: public class XMenu extends Menu implements XTextHolder, XAppender {
15: public XMenu() {
16: }
17:
18: /**
19: * Do any final setup needed
20: */
21: public void setup() {
22: }
23:
24: public void setText(String newText) {
25: super .setLabel(newText);
26: }
27:
28: /**
29: * Gets the text/caption
30: * @return the text value
31: */
32: public String getText() {
33: return super .getLabel();
34: }
35:
36: /**
37: * Appends the object o to this item
38: * @param o the appended item
39: * @param name
40: */
41: public void append(Object o, String name) {
42: if (o != null) {
43: ((MenuItem) o).setName(name);
44: add((MenuItem) o);
45: } else
46: addSeparator();
47: }
48:
49: /**
50: * Get a child object by name
51: * @param name
52: * @return the child
53: */
54: public Object getObject(String name) {
55: return null;
56: }
57: }
|