Container c = getContainer(p); if (!c.contains(p)) return false; JComponent component = null; if (id.startsWith("Strut")) { component = new Strut(p.x, p.y); ((SpringLayout)c.getLayout()) .addLayoutComponent(component, ((Strut)component).getConstraints()); } else if (id.startsWith("Button")) component = new ButtonWidget(); else if (id.startsWith("Label")) component = new LabelWidget(); else if (id.startsWith("Panel")) { component = new PanelWidget();  Strut s = new Strut(92,0,8, 100); addWidget(s); component.add(s); ((SpringLayout)component.getLayout()) .addLayoutComponent(s, s.getConstraints()); s = new Strut(0, 92, 100, 8); addWidget(s); component.add(s); ((SpringLayout)component.getLayout()) .addLayoutComponent(s, s.getConstraints()); s = new Strut(0, 0, default_padding, default_padding); addWidget(s); component.add(s); ((SpringLayout)component.getLayout()) .addLayoutComponent(s, s.getConstraints()); } else { Parameter pm = ParameterFrame.getParameter(id); switch (pm.getType()) { case Parameter.STRING: component = new StringParameterWidget(pm); break; case Parameter.LOOKUP: component = new LookupParameterWidget(pm); break; case Parameter.RANGE: component = new RangeParameterWidget(pm); break; default: throw new Error("Unknown parameter type " + pm); } }  c.add(component); if (component instanceof AnchoredWidget) setConstraints(component, p, c); if (component instanceof Widget) addWidget((Widget)component);   designer.validate();  designer.repaint();    return true;  }
Container c = getContainer(p); if (!c.contains(p)) return false; Widget component = null; if (id.startsWith("Strut")) { Strut s = new Strut(p.x, p.y); ((SpringLayout) c.getLayout()).addLayoutComponent(s, s.getConstraints()); component = s; } else if (id.startsWith("Button")) component = new ButtonWidget(); else if (id.startsWith("Label")) component = new LabelWidget(); else if (id.startsWith("Panel")) { component = new PanelWidget();  Strut s = new Strut(92, 0, 8, 100); addWidget(s); component.add(s); ((SpringLayout) component.getLayout()).addLayoutComponent(s, s .getConstraints()); s = new Strut(0, 92, 100, 8); addWidget(s); component.add(s); ((SpringLayout) component.getLayout()).addLayoutComponent(s, s .getConstraints()); s = new Strut(0, 0, default_padding, default_padding); addWidget(s); component.add(s); ((SpringLayout) component.getLayout()).addLayoutComponent(s, s .getConstraints()); } else { Parameter pm = ParameterFrame.getParameter(id); switch (pm.getType()) { case Parameter.STRING: component = new StringParameterWidget(pm); break; case Parameter.LOOKUP: component = new LookupParameterWidget(pm); break; case Parameter.RANGE: component = new RangeParameterWidget(pm); break; default: throw new Error("Unknown parameter type " + pm); }  }  c.add(component); if (component instanceof AnchoredWidget) setConstraints(component, p, c); addWidget(component); for (;;) { c.validate(); if (c == designer.getRootWidget()) break; c = c.getParent(); }  designer.validate();  designer.repaint();    return true;  }
	protected boolean addComponent(String id, Point p) {		Container c = getContainer(p);		if (!c.contains(p))			return false;		JComponent component = null;		if (id.startsWith("Strut")) {			component = new Strut(p.x, p.y);			((SpringLayout)c.getLayout())			.addLayoutComponent(component,					((Strut)component).getConstraints());		} else if (id.startsWith("Button"))			component = new ButtonWidget();		else if (id.startsWith("Label"))			component = new LabelWidget();		else if (id.startsWith("Panel")) {			component = new PanelWidget();			//containers.add(component);			Strut s = new Strut(92,0,8, 100);			addWidget(s);			component.add(s);			((SpringLayout)component.getLayout())			.addLayoutComponent(s,					s.getConstraints());			s = new Strut(0, 92, 100, 8);			addWidget(s);			component.add(s);			((SpringLayout)component.getLayout())			.addLayoutComponent(s,					s.getConstraints());			s = new Strut(0, 0, default_padding, default_padding);			addWidget(s);			component.add(s);			((SpringLayout)component.getLayout())			.addLayoutComponent(s,					s.getConstraints());		} else {			Parameter pm = ParameterFrame.getParameter(id);			switch (pm.getType()) {			case Parameter.STRING:				component = new StringParameterWidget(pm);			break;			case Parameter.LOOKUP:				component = new LookupParameterWidget(pm);			break;			case Parameter.RANGE:				component = new RangeParameterWidget(pm);			break;			default:				throw new Error("Unknown parameter type " + pm);			}		}				c.add(component);		if (component instanceof AnchoredWidget)			setConstraints(component, p, c);		if (component instanceof Widget)			addWidget((Widget)component);				//component.validate();		designer.validate();		//component.repaint();		designer.repaint();				//Anchor.printCmap();				return true;			}