01: /*
02: * @(#)DelegateMouseMotionListener.java 1/30/2007
03: *
04: * Copyright 2002 - 2007 JIDE Software Inc. All rights reserved.
05: */
06:
07: package com.jidesoft.swing;
08:
09: import java.awt.event.MouseEvent;
10: import java.awt.event.MouseMotionListener;
11:
12: /**
13: * This mouse motion listener can delegate the mouse events to another mouse motion listener.
14: * It can be used when you need to do something extra steps when there is a mouse motion event but you still
15: * want the original mouse motion listener to be called under certain condition.
16: */
17: public class DelegateMouseMotionListener implements MouseMotionListener {
18: private MouseMotionListener _listener;
19:
20: public DelegateMouseMotionListener(MouseMotionListener listener) {
21: _listener = listener;
22: }
23:
24: public void mouseDragged(MouseEvent e) {
25: if (_listener != null) {
26: _listener.mouseDragged(e);
27: }
28: }
29:
30: public void mouseMoved(MouseEvent e) {
31: if (_listener != null) {
32: _listener.mouseMoved(e);
33: }
34: }
35: }
|