Java Code Examples for java.awt.event.ContainerEvent#getContainer()

The following examples show how to use java.awt.event.ContainerEvent#getContainer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CloseTabPaneUI.java    From iBioSim with Apache License 2.0 6 votes vote down vote up
@Override
public void componentAdded(ContainerEvent e) {
	JTabbedPane tp = (JTabbedPane) e.getContainer();
	Component child = e.getChild();
	if (child instanceof UIResource) {
		return;
	}
	int index = tp.indexOfComponent(child);
	String title = tp.getTitleAt(index);
	boolean isHTML = BasicHTML.isHTMLString(title);
	if (isHTML) {
		if (htmlViews == null) { // Initialize vector
			htmlViews = createHTMLVector();
		}
		else { // Vector already exists
			View v = BasicHTML.createHTMLView(tp, title);
			htmlViews.insertElementAt(v, index);
		}
	}
	else { // Not HTML
		if (htmlViews != null) { // Add placeholder
			htmlViews.insertElementAt(null, index);
		} // else nada!
	}
}
 
Example 2
Source File: CloseTabPaneUI.java    From iBioSim with Apache License 2.0 6 votes vote down vote up
@Override
public void componentRemoved(ContainerEvent e) {
	JTabbedPane tp = (JTabbedPane) e.getContainer();
	Component child = e.getChild();
	if (child instanceof UIResource) {
		return;
	}

	// NOTE 4/15/2002 (joutwate):
	// This fix is implemented using client properties since there is
	// currently no IndexPropertyChangeEvent. Once
	// IndexPropertyChangeEvents have been added this code should be
	// modified to use it.
	Integer indexObj = (Integer) tp.getClientProperty("__index_to_remove__");
	if (indexObj != null) {
		int index = indexObj.intValue();
		if (htmlViews != null && htmlViews.size() >= index) {
			htmlViews.removeElementAt(index);
		}
	}
}
 
Example 3
Source File: AbstractMenuFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void componentAdded(ContainerEvent e) {
    JMenu menu = (JMenu) e.getContainer();
    JComponent item = (JComponent) e.getChild();
    //Mark the child as belonging to the parent container context
    String containerContext = getContainerContext(menu);
    
    item.putClientProperty (KEY_CONTAINERCONTEXT, containerContext);
}
 
Example 4
Source File: JButtonBar.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
public void componentAdded(ContainerEvent e) {
  JButtonBar container = (JButtonBar)e.getContainer();
  if (e.getChild() instanceof AbstractButton) {
    ((ButtonBarUI)container.ui).installButtonBarUI(
      (AbstractButton)e.getChild());
    ((AbstractButton)e.getChild()).addPropertyChangeListener(
      "UI",
      JButtonBar.uiUpdater);
  }
}
 
Example 5
Source File: AbstractToolbarFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void componentAdded(ContainerEvent e) {
    JComponent jc = (JComponent) e.getChild();
    JToolBar tb = (JToolBar) e.getContainer();
    String ctx = (String) tb.getClientProperty(KEY_CONTAINERCTX);
    jc.putClientProperty (KEY_CONTAINERCTX, ctx);
}
 
Example 6
Source File: AbstractMenuFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void componentRemoved(ContainerEvent e) {
    JComponent menu = (JComponent) e.getContainer();
    JComponent item = (JComponent) e.getChild();
    item.putClientProperty (KEY_CONTAINERCONTEXT, null);
}
 
Example 7
Source File: DescendantListener.java    From pumpernickel with MIT License 4 votes vote down vote up
@Override
public void componentAdded(ContainerEvent e) {
	if (!(e.getContainer() instanceof CellRendererPane))
		processAddition(e.getChild());
}