Groovy Documentation

com.wordpress.tipsforjava.swing
[Java] Class ToolTipListener

java.lang.Object
  com.wordpress.tipsforjava.swing.ToolTipListener
All Implemented Interfaces:
ComponentListener, MouseWheelListener, AdjustmentListener

public class ToolTipListener
extends Object

This class is used to help generate tooltips on components added to a scrollpane. Generally tooltips are generated as the mouse if moved over components that display tooltips. On complex component, like a JTable the component can generate multiple tooltips depending on which cell the mouse is positioned over. However, when the viewport of the scrollpane is moved and the mouse is not moved the tooltip is not updated even though the mouse is positioned over a different cell. This might happen for example when the mouse wheel is used to scroll the viewport. To force updating of the tooltip, this class will generate a phantom mouseMoved event which is passed to the ToolTipManager. This class is actually a 3 in 1 listener and will work slightly different depending on how it is being used. When used as a: a) MouseWheelListener - it is added to the scrollpane. In this case the mouseMoved events are only generated by scrolling of the mouse wheel and therefore only supports vertical movement of the viewport b) AdjustmentListener - is added to the vertical and/or horizontal scrollbar. In this case the viewport can be scrolled by using the mouse wheel or the keyboard and mouseMoved events will be generated. c) ComponentListener - it is added to the component. In this case all forms of viewport movement as well as changes in the component size will cause the mouseMoved event to be generated.

Authors:
Rob Camick
Darryl Burke


Constructor Summary
ToolTipListener()

 
Method Summary
void adjustmentValueChanged(AdjustmentEvent e)

void componentHidden(ComponentEvent e)

void componentMoved(ComponentEvent e)

void componentResized(ComponentEvent e)

void componentShown(ComponentEvent e)

void mouseWheelMoved(MouseWheelEvent e)

private void phantomMouseMoved(Component component)

Create a mouseMoved event to pass to the ToolTipManager.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

ToolTipListener

ToolTipListener()


 
Method Detail

adjustmentValueChanged

public void adjustmentValueChanged(AdjustmentEvent e)


componentHidden

public void componentHidden(ComponentEvent e)


componentMoved

public void componentMoved(ComponentEvent e)


componentResized

public void componentResized(ComponentEvent e)


componentShown

public void componentShown(ComponentEvent e)


mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent e)


phantomMouseMoved

private void phantomMouseMoved(Component component)
Create a mouseMoved event to pass to the ToolTipManager.


 

Groovy Documentation