Exemplo n.º 1
0
 private void detachFromHierarchyOf(Container container) {
   container.removeContainerListener(this);
   Component[] components = container.getComponents();
   for (int i = 0; i < components.length; i++) {
     detachFrom(components[i]); // Will callback recursively any nested JPanels
   }
 }
Exemplo n.º 2
0
 public void uninstallRecursively(Component c) {
   uninstall(c);
   if (c instanceof Container) {
     Container cont = (Container) c;
     cont.removeContainerListener(containerListener);
     uninstallRecursively(cont);
   }
 }
Exemplo n.º 3
0
 private void componentRemoved(Component comp) {
   comp.removeKeyListener(keyHandler);
   if (comp instanceof Container) {
     Container cont = (Container) comp;
     cont.removeContainerListener(this);
     Component[] comps = cont.getComponents();
     for (Component comp1 : comps) componentRemoved(comp1);
   }
 }
Exemplo n.º 4
0
 /**
  * This method removes the {@link KeyListener} from all removed components. This is done
  * recursively.
  *
  * @param c The {@link Component} that is removed.
  */
 private void removeKeyAndContainerListenerRecursively(final Component c) {
   c.removeKeyListener(this);
   if (c instanceof Container) {
     final Container cont = (Container) c;
     cont.removeContainerListener(this);
     final Component[] children = cont.getComponents();
     for (int i = 0; i < children.length; i++) {
       removeKeyAndContainerListenerRecursively(children[i]);
     }
   }
 }
Exemplo n.º 5
0
 void uninstallListeners(Component component) {
   for (ComponentListener listener : componentListeners)
     component.removeComponentListener(listener);
   for (KeyListener listener : keyListeners) component.removeKeyListener(listener);
   for (MouseListener listener : mouseListeners) component.removeMouseListener(listener);
   for (MouseMotionListener listener : mouseMotionListeners)
     component.removeMouseMotionListener(listener);
   if (component instanceof Container) {
     Container container = (Container) component;
     container.removeContainerListener(containerListener);
     for (int iComp = container.getComponentCount(); iComp-- != 0; ) {
       uninstallListeners(container.getComponent(iComp));
     }
   }
 }