Java Code Examples for java.awt.Container#removeContainerListener()

The following examples show how to use java.awt.Container#removeContainerListener() . 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: FileOpenDropHandler.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void deinitializeComponents(Component comp) {
	if (comp instanceof CellRendererPane) {
		return;
	}

	if (comp instanceof Container) {
		Container c = (Container) comp;
		c.removeContainerListener(this);
		Component comps[] = c.getComponents();
		for (Component element : comps) {
			deinitializeComponents(element);
		}
	}
	DropTarget dt = comp.getDropTarget();
	if (dt instanceof CascadedDropTarget) {
		CascadedDropTarget target = (CascadedDropTarget) dt;
		DropTarget newTarget = target.removeDropTarget(globalDropTarget);
		comp.setDropTarget(newTarget);
	}
}
 
Example 2
Source File: HyperlinkSupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void registerChildren(Component c, IssueLinker issueLinker) {
    if(c instanceof Container) {
        Container container = (Container) c;
        container.removeContainerListener(regListener);
        container.addContainerListener(regListener);
        
        Component[] components = container.getComponents();
        for (Component cmp : components) {
            registerChildren(cmp, issueLinker);
        }
    } if(c instanceof JTextPane) {
        JTextPane tp = (JTextPane) c;
        if(!tp.isEditable()) {
            registerTask.add(tp, issueLinker);
        }
    }
}
 
Example 3
Source File: ReplaceDialog.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private void registerKeyAction(Component c) {
    if (c instanceof ReplaceDialog == false) {
        c.removeKeyListener(this);
        c.addKeyListener(this);
    }

    if (c instanceof Container) {
        Container cnt = (Container) c;
        cnt.removeContainerListener(this);
        cnt.addContainerListener(this);
        Component[] ch = cnt.getComponents();
        for (int i = 0; i < ch.length; i++) {
            registerKeyAction(ch[i]);
        }
    }
}
 
Example 4
Source File: EscapableDialog.java    From rest-client with Apache License 2.0 6 votes vote down vote up
private void registerKeyAction(Component c) {
    if (c instanceof EscapableDialog == false) {
        c.removeKeyListener(this);
        c.addKeyListener(this);
    }

    if (c instanceof Container) {
        Container cnt = (Container) c;
        cnt.removeContainerListener(this);
        cnt.addContainerListener(this);
        Component[] ch = cnt.getComponents();
        for (int i = 0; i < ch.length; i++) {
            registerKeyAction(ch[i]);
        }
    }
}
 
Example 5
Source File: DescendantListener.java    From pumpernickel with MIT License 5 votes vote down vote up
private void processRemoval(Component c) {
	if (components.remove(c)) {
		unregister(c);
		if (c instanceof Container) {
			Container container = (Container) c;
			container.removeContainerListener(containerListener);
			for (Component child : container.getComponents()) {
				processRemoval(child);
			}
		}
	}
}
 
Example 6
Source File: MagnificationPanel.java    From pumpernickel with MIT License 5 votes vote down vote up
private void removeMouseListeners(Component c) {
	c.removeMouseMotionListener(mouseListener);
	c.removeMouseListener(mouseListener);
	if (c instanceof Container) {
		Container c2 = (Container) c;
		c2.removeContainerListener(containerListener);
		for (Component child : c2.getComponents()) {
			addMouseListeners(child);
		}
	}
}
 
Example 7
Source File: ClarifyingKeyListener.java    From SNT with GNU General Public License v3.0 5 votes vote down vote up
private void removeKeyAndContainerListenerRecursively(final Component c) {
	c.removeKeyListener(this);
	if (c instanceof Container) {
		final Container container = (Container) c;
		container.removeContainerListener(this);
		final Component[] children = container.getComponents();
		for (int i = 0; i < children.length; i++) {
			removeKeyAndContainerListenerRecursively(children[i]);
		}
	}
}