List of usage examples for java.awt Component removeMouseListener
public synchronized void removeMouseListener(MouseListener l)
From source file:Main.java
public static void removeMouseListenerToHierarchy(JComponent c, MouseListener listener) { for (Component comp : c.getComponents()) { comp.removeMouseListener(listener); if (comp instanceof JComponent) { removeMouseListenerToHierarchy((JComponent) comp, listener); }// w ww . ja v a2 s . co m } }
From source file:Main.java
public static Map<Component, List<MouseListener>> storeMouseListeners(final JComponent root) { final Map<Component, List<MouseListener>> map = new HashMap<Component, List<MouseListener>>(); for (final Component c : getAllSubComponents(root)) { map.put(c, new ArrayList<MouseListener>()); for (final MouseListener m : c.getMouseListeners()) { c.removeMouseListener(m); map.get(c).add(m);/* w ww . j av a 2 s . co m*/ } } return map; }
From source file:Main.java
/** * Inserts the mouse listener at the particular index in the listeners' chain. * * @param component//from ww w .ja v a2 s. c o m * @param l * @param index */ public static void insertMouseListener(Component component, MouseListener l, int index) { MouseListener[] listeners = component.getMouseListeners(); for (MouseListener listener : listeners) { component.removeMouseListener(listener); } for (int i = 0; i < listeners.length; i++) { MouseListener listener = listeners[i]; if (index == i) { component.addMouseListener(l); } component.addMouseListener(listener); } // inex is too large, add to the end. if (index > listeners.length - 1) { component.addMouseListener(l); } }
From source file:Main.java
/** * Remove mouse listeners form the argument component. * //w w w.j ava2s.c om * @param cmp The component. */ public static void removeMouseListeners(Component cmp) { MouseListener[] listeners = cmp.getMouseListeners(); if (listeners != null) { for (MouseListener listener : listeners) { cmp.removeMouseListener(listener); } } }
From source file:edu.ku.brc.ui.UIHelper.java
/** * Removes the Mouse Listeners.//from w w w . j a va 2s. c om * @param c component */ public static void removeMouseListeners(final Component c) { if (c != null) { for (MouseListener l : c.getMouseListeners()) { c.removeMouseListener(l); } for (MouseMotionListener l : c.getMouseMotionListeners()) { c.removeMouseMotionListener(l); } } }
From source file:org.nuclos.client.ui.collect.component.CollectableComboBox.java
private static void removeAllJPopupMenuListeners(Component comp) { for (MouseListener ml : comp.getMouseListeners()) { if (ml instanceof JPopupMenuListener) { comp.removeMouseListener(ml); }// w w w . j ava2 s .c om } }