01: package net.xoetrope.builder.editor.components.swing;
02:
03: import javax.swing.JPanel;
04: import javax.swing.BorderFactory;
05: import java.awt.Component;
06: import java.awt.Dimension;
07: import java.awt.Color;
08:
09: /**
10: * A stand-in for editing menus
11: * <p> Copyright (c) Xoetrope Ltd., 2002-2003</p>
12: * <p> $Revision: 1.1 $</p>
13: * <p> License: see License.txt</p>
14: */
15: public class XMenuProxy extends JPanel {
16: public XMenuProxy() {
17: setLayout(null);
18: setBorder(BorderFactory.createLineBorder(Color.green));
19: setOpaque(true);
20: }
21:
22: /**
23: * Only allow addition of menus
24: * @param c
25: */
26: public Component add(Component c) {
27: if (c instanceof XMenuItemProxy)
28: return super .add(c);
29:
30: return null;
31: }
32:
33: /**
34: * Get the maximum size for this component. As the component is only a stand-in
35: * for a runtime component we limit its size to 20x20
36: * @return
37: */
38: public Dimension getMaximumSize() {
39: return new Dimension(20, 20);
40: }
41: }
|