Example usage for java.awt Canvas removeMouseListener

List of usage examples for java.awt Canvas removeMouseListener

Introduction

In this page you can find the example usage for java.awt Canvas removeMouseListener.

Prototype

public synchronized void removeMouseListener(MouseListener l) 

Source Link

Document

Removes the specified mouse listener so that it no longer receives mouse events from this component.

Usage

From source file:Main.java

public static void removeListenerMouse(Class clazz, Canvas canvas) {
    for (Object event : canvas.getListeners(clazz)) {
        if (clazz == MouseListener.class) {
            canvas.removeMouseListener((MouseListener) event);
        } else {//ww w.  j  a va  2  s. c o m
            if (clazz == MouseMotionListener.class) {
                canvas.removeMouseMotionListener((MouseMotionListener) event);
            }
        }
    }
}