public abstract class MouseOverListener extends MouseAdapter implements 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(Component parent)
Creates a new listener
|
Modifier and Type | Method and Description |
---|---|
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. |
mouseClicked, mouseDragged, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved
public MouseOverListener(Component parent)
parent
- the component to observepublic void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
mouseEntered
in class MouseAdapter
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
mouseExited
in class MouseAdapter
protected abstract void changed()
public boolean isMouseOver()
true
if the mouse is within the borders of the
base componentpublic void componentAdded(ContainerEvent e)
componentAdded
in interface ContainerListener
protected void added(Component component)
component
and its children.component
- the new component to observepublic void componentRemoved(ContainerEvent e)
componentRemoved
in interface ContainerListener
protected void removed(Component component)
component
and its children.component
- the component which should no longer be observed