if (comp.isLightweight()) enableEvents(comp.eventMask); }
invalidate();
	protected void addImpl(Component comp, Object constraints, int index) {		synchronized (getTreeLock()) {			if (index > ncomponents				|| (index < 0 && index != -1)				|| comp instanceof Window				|| (comp instanceof Container && ((Container) comp).isAncestorOf(this)))				throw new IllegalArgumentException();			// Reparent component, and make sure component is instantiated if			// we are.			if (comp.parent != null)				comp.parent.remove(comp);			comp.parent = this;			if (peer != null) {				comp.addNotify();				if (comp.isLightweight())					enableEvents(comp.eventMask);			}			invalidate();			if (component == null)				component = new Component[4]; // FIXME, better initial size?			// This isn't the most efficient implementation.  We could do less			// copying when growing the array.  It probably doesn't matter.			if (ncomponents >= component.length) {				int nl = component.length * 2;				Component[] c = new Component[nl];				System.arraycopy(component, 0, c, 0, ncomponents);				component = c;			}			if (index == -1)				component[ncomponents++] = comp;			else {				System.arraycopy(component, index, component, index + 1, ncomponents - index);				component[index] = comp;				++ncomponents;			}			// Notify the layout manager.			if (layoutMgr != null) {				if (layoutMgr instanceof LayoutManager2) {					LayoutManager2 lm2 = (LayoutManager2) layoutMgr;					lm2.addLayoutComponent(comp, constraints);				} else if (constraints instanceof String)					layoutMgr.addLayoutComponent((String) constraints, comp);				else					layoutMgr.addLayoutComponent(null, comp);			}			// Post event to notify of adding the container.			ContainerEvent ce = new ContainerEvent(this, ContainerEvent.COMPONENT_ADDED, comp);			getToolkit().getSystemEventQueue().postEvent(ce);		}	}