bibliothek.extension.gui.dock.util
Class MouseOverListener

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by bibliothek.extension.gui.dock.util.MouseOverListener
All Implemented Interfaces:
ContainerListener, MouseListener, MouseMotionListener, MouseWheelListener, EventListener

public abstract class MouseOverListener
extends MouseAdapter
implements ContainerListener

A class that can observe a Component and the children of the same component to find out whether the mouse is over the base component. This also works if the children of the base component do not let MouseEvents through.

Author:
Benjamin Sigg

Constructor Summary
MouseOverListener(Component parent)
          Creates a new listener
 
Method Summary
protected  void added(Component component)
          Adds listeners to component and its children.
protected abstract  void changed()
          Called whenever the mouse-over state changed.
 void componentAdded(ContainerEvent e)
           
 void componentRemoved(ContainerEvent e)
           
 boolean isMouseOver()
          Tells whether the mouse is currently over the base component.
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
protected  void removed(Component component)
          Removes listeners from component and its children.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseDragged, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MouseOverListener

public MouseOverListener(Component parent)
Creates a new listener

Parameters:
parent - the component to observe
Method Detail

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener
Overrides:
mouseEntered in class MouseAdapter

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener
Overrides:
mouseExited in class MouseAdapter

changed

protected abstract void changed()
Called whenever the mouse-over state changed.


isMouseOver

public boolean isMouseOver()
Tells whether the mouse is currently over the base component.

Returns:
true if the mouse is within the borders of the base component

componentAdded

public void componentAdded(ContainerEvent e)
Specified by:
componentAdded in interface ContainerListener

added

protected void added(Component component)
Adds listeners to component and its children.

Parameters:
component - the new component to observe

componentRemoved

public void componentRemoved(ContainerEvent e)
Specified by:
componentRemoved in interface ContainerListener

removed

protected void removed(Component component)
Removes listeners from component and its children.

Parameters:
component - the component which should no longer be observed