org.jdesktop.swingx.rollover
public abstract class RolloverProducer extends java.lang.Object implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
Note: this class assumes that the target component is of type JComponent.
Note: this implementation is stateful, it can't be shared across different instances of a target component.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLICKED_KEY
Key for client property mapped from mouse-triggered action.
|
protected java.awt.Point |
rollover
Current mouse location in client coordinates.
|
static java.lang.String |
ROLLOVER_KEY
Key for client property mapped from rollover events
|
Constructor and Description |
---|
RolloverProducer() |
Modifier and Type | Method and Description |
---|---|
void |
mouseClicked(java.awt.event.MouseEvent e)
Implemented to do nothing.
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Implemented to do nothing.
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Implemented to map to client property rollover and fire only if client
coordinate changed.
|
void |
mouseExited(java.awt.event.MouseEvent e)
Implemented to remove client properties rollover and clicked.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Implemented to map to client property rollover and fire only if client
coordinate changed.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Implemented to do nothing.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Implemented to map to client property clicked and fire always.
|
protected void |
updateClientProperty(javax.swing.JComponent component,
java.lang.String property,
boolean fireAlways)
Sets the given client property to the value of current mouse location in
client coordinates.
|
protected void |
updateRollover(java.awt.event.MouseEvent e,
java.lang.String property,
boolean fireAlways)
Controls the mapping of the given mouse event to a client property.
|
protected abstract void |
updateRolloverPoint(javax.swing.JComponent component,
java.awt.Point mousePoint)
Subclasses must implement to map the given mouse coordinates into
appropriate client coordinates.
|
public static final java.lang.String CLICKED_KEY
public static final java.lang.String ROLLOVER_KEY
protected java.awt.Point rollover
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
protected void updateRollover(java.awt.event.MouseEvent e, java.lang.String property, boolean fireAlways)
e
- the MouseEvent to map to client coordinatesproperty
- the client property to map tofireAlways
- a flag indicating whether a client event should be fired if unchanged.updateRolloverPoint(JComponent, Point)
,
updateClientProperty(JComponent, String, boolean)
protected void updateClientProperty(javax.swing.JComponent component, java.lang.String property, boolean fireAlways)
component
- the target componentproperty
- the client property to setfireAlways
- a flag indicating whether a client property
should be forced to fire an event.protected abstract void updateRolloverPoint(javax.swing.JComponent component, java.awt.Point mousePoint)
component
- the target component which received a mouse eventmousePoint
- the mouse position of the event, coordinates are
component pixels