List of usage examples for javax.swing JComponent removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
From source file:Main.java
/** * Recursively remove all PropertyChangeListeners from a component * @param container/* www . j a va 2 s. c o m*/ */ public static void removeAllPropertyChangeListeners(JComponent component) { if (component.getComponentCount() > 0) { for (Component child : component.getComponents()) { if (child instanceof JComponent) { removeAllPropertyChangeListeners((JComponent) child); } } } PropertyChangeListener[] tmpList = component.getPropertyChangeListeners(); for (PropertyChangeListener listener : tmpList) { component.removePropertyChangeListener(listener); } }
From source file:FormattedTextFieldExample.java
public void uninstallUI(JComponent c) { super.uninstallUI(c); c.removePropertyChangeListener(this); }
From source file:com.googlecode.vfsjfilechooser2.plaf.metal.MetalVFSFileChooserUI.java
@Override public void uninstallUI(JComponent c) { // Remove listeners c.removePropertyChangeListener(filterComboBoxModel); c.removePropertyChangeListener(filePane); cancelButton.removeActionListener(getCancelSelectionAction()); approveButton.removeActionListener(getApproveSelectionAction()); fileNameTextField.removeActionListener(getApproveSelectionAction()); if (filePane != null) { filePane.uninstallUI();/*from w w w. j av a 2 s. c om*/ filePane = null; } super.uninstallUI(c); }
From source file:Main.java
private static void disposeComponent(JComponent component) { if (component == null) { return;// ww w. j a v a 2 s.c om } component.removeNotify(); FocusListener[] focusListeners = component.getFocusListeners(); for (int i = 0; i < focusListeners.length; i++) { component.removeFocusListener(focusListeners[i]); } KeyListener[] keyListeners = component.getKeyListeners(); for (int i = 0; i < keyListeners.length; i++) { component.removeKeyListener(keyListeners[i]); } AncestorListener[] ancestorListener = component.getAncestorListeners(); for (int i = 0; i < ancestorListener.length; i++) { component.removeAncestorListener(ancestorListener[i]); } ComponentListener[] componentListeners = component.getComponentListeners(); for (int i = 0; i < componentListeners.length; i++) { component.removeComponentListener(componentListeners[i]); } HierarchyListener[] hierarchyListeners = component.getHierarchyListeners(); for (int i = 0; i < hierarchyListeners.length; i++) { component.removeHierarchyListener(hierarchyListeners[i]); } HierarchyBoundsListener[] hierarchyBoundsListeners = component.getHierarchyBoundsListeners(); for (int i = 0; i < hierarchyBoundsListeners.length; i++) { component.removeHierarchyBoundsListener(hierarchyBoundsListeners[i]); } InputMethodListener[] inputMethodListeners = component.getInputMethodListeners(); for (int i = 0; i < inputMethodListeners.length; i++) { component.removeInputMethodListener(inputMethodListeners[i]); } MouseListener[] mouseLisetners = component.getMouseListeners(); for (int i = 0; i < mouseLisetners.length; i++) { component.removeMouseListener(mouseLisetners[i]); } MouseMotionListener[] mouseMotionLisetners = component.getMouseMotionListeners(); for (int i = 0; i < mouseMotionLisetners.length; i++) { component.removeMouseMotionListener(mouseMotionLisetners[i]); } MouseWheelListener[] mouseWheelListeners = component.getMouseWheelListeners(); for (int i = 0; i < mouseWheelListeners.length; i++) { component.removeMouseWheelListener(mouseWheelListeners[i]); } PropertyChangeListener[] propertyChangeListeners = component.getPropertyChangeListeners(); for (int i = 0; i < propertyChangeListeners.length; i++) { component.removePropertyChangeListener(propertyChangeListeners[i]); } VetoableChangeListener[] vetoableChangeListener = component.getVetoableChangeListeners(); for (int i = 0; i < vetoableChangeListener.length; i++) { component.removeVetoableChangeListener(vetoableChangeListener[i]); } }