public abstract class MouseOverListener
extends java.awt.event.MouseAdapter
implements java.awt.event.ContainerListener
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 MouseEvent
s through.Constructor and Description |
---|
MouseOverListener(java.awt.Component parent)
Creates a new listener
|
Modifier and Type | Method and Description |
---|---|
protected void |
added(java.awt.Component component)
Adds listeners to
component and its children. |
protected abstract void |
changed()
Called whenever the mouse-over state changed.
|
void |
componentAdded(java.awt.event.ContainerEvent e) |
void |
componentRemoved(java.awt.event.ContainerEvent e) |
boolean |
isMouseOver()
Tells whether the mouse is currently over the base component.
|
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
protected void |
removed(java.awt.Component component)
Removes listeners from
component and its children. |
public MouseOverListener(java.awt.Component parent)
parent
- the component to observepublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
mouseEntered
in class java.awt.event.MouseAdapter
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
mouseExited
in class java.awt.event.MouseAdapter
protected abstract void changed()
public boolean isMouseOver()
true
if the mouse is within the borders of the
base componentpublic void componentAdded(java.awt.event.ContainerEvent e)
componentAdded
in interface java.awt.event.ContainerListener
protected void added(java.awt.Component component)
component
and its children.component
- the new component to observepublic void componentRemoved(java.awt.event.ContainerEvent e)
componentRemoved
in interface java.awt.event.ContainerListener
protected void removed(java.awt.Component component)
component
and its children.component
- the component which should no longer be observed