Java Swing Mouse disableDoubleMouseClick(Component c)

Here you can find the source of disableDoubleMouseClick(Component c)

Description

disable Double Mouse Click

License

Open Source License

Declaration

public static void disableDoubleMouseClick(Component c) 

Method Source Code


//package com.java2s;
/*//from ww w  . j a v a 2  s. c  om
 * Copyright (C) 2003 by Institute for Systems Biology,
 * Seattle, Washington, USA.  All rights reserved.
 * 
 * This source code is distributed under the GNU Lesser 
 * General Public License, the text of which is available at:
 *   http://www.gnu.org/copyleft/lesser.html
 */

import java.awt.*;
import javax.swing.*;

public class Main {
    public static void disableDoubleMouseClick(Component c) {
        if (c instanceof JList) {
            java.util.EventListener[] listeners = c.getListeners(java.awt.event.MouseListener.class);
            for (int i = 0; i < listeners.length; i++) {
                if (listeners[i].toString().indexOf("SingleClickListener") != -1) {
                    c.removeMouseListener((java.awt.event.MouseListener) listeners[i]);
                }
            }
            return;
        }
        Component[] children = null;
        if (c instanceof Container) {
            children = ((Container) c).getComponents();
        }
        if (children != null) {
            for (int i = 0; i < children.length; i++) {
                disableDoubleMouseClick(children[i]);
            }
        }
    }
}

Related

  1. convertMouseEvent(java.awt.Component source, java.awt.event.MouseEvent sourceEvent, java.awt.Component destination)
  2. convertPoint(MouseEvent evt, Component target)
  3. createButton(JComponent parent, String description, MouseListener listener)
  4. decorateComponentWithMouseOverCursorChange(final JComponent toDecorate, final int mouseEntered, final int mouseExited)
  5. delegateEventToParent(Component component, MouseEvent e)
  6. forwardMouseWheelEvent(JScrollPane target, MouseWheelEvent evt)
  7. getDeepestComponentAt(final MouseEvent aEvent)
  8. inInsets(MouseEvent me)
  9. installMouseListener(Component cmp, MouseListener mouseListener, boolean removePrevious)