Groovy Documentation

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

java.lang.Object
  com.wordpress.tipsforjava.swing.ScrollBarToolTip
      com.wordpress.tipsforjava.swing.JumpScrollBarToolTip

public class JumpScrollBarToolTip
extends ScrollBarToolTip

This class extends Rob Camick's ScrollBarToolTip to provide support for a scroll bar that has a JumpScrollBarModel. The sole difference is that the tool tip text is computed on the basis of the model's true value as returned by the getTrueValue() method instead of the value returned by getValue().

An attempt to use this class with a scroll bar that does not have an appropriate model will result in a ClassCastException.

Authors:
Rob Camick
Darryl Burke
See Also:
ScrollBarToolTip
JumpScrollBarModel


Field Summary
 
Fields inherited from class ScrollBarToolTip
ADJUSTMENT, GAP, popup, position, pressedPoint, scrollBar, style, toolTip
 
Constructor Summary
JumpScrollBarToolTip(JScrollPane scrollPane)

Creates a JumpScrollBarToolTip for a JScrollPane's vertical scroll bar, which must have a JumpScrollBarModel, with the default Style (FIXED_PRESSED) and Position (INSIDE).

JumpScrollBarToolTip(JScrollBar scrollBar)

Creates a JumpScrollBarToolTip for a scroll bar that has a JumpScrollBarModel, with the default Style (FIXED_PRESSED,) and Position (INSIDE).

JumpScrollBarToolTip(JScrollBar scrollBar, Style style, Position position)

Creates a JumpScrollBarToolTip for a scroll bar that has a JumpScrollBarModel, with the specified Style and Position.

 
Method Summary
protected String getToolTipText(MouseEvent event)

Determine the tooltip text for the every MouseEvent.

 
Methods inherited from class ScrollBarToolTip
getHorizontalX, getHorizontalY, getPosition, getStyle, getToolTipLocation, getToolTipText, getVerticalX, getVerticalY, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, setPosition, setStyle, showToolTip, valueOf, valueOf, values, values
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

JumpScrollBarToolTip

public JumpScrollBarToolTip(JScrollPane scrollPane)
Creates a JumpScrollBarToolTip for a JScrollPane's vertical scroll bar, which must have a JumpScrollBarModel, with the default Style (FIXED_PRESSED) and Position (INSIDE).

Parameters:
scrollPane - the scroll pane


JumpScrollBarToolTip

public JumpScrollBarToolTip(JScrollBar scrollBar)
Creates a JumpScrollBarToolTip for a scroll bar that has a JumpScrollBarModel, with the default Style (FIXED_PRESSED,) and Position (INSIDE).
Parameters:
scrollBar - the scroll bar


JumpScrollBarToolTip

public JumpScrollBarToolTip(JScrollBar scrollBar, Style style, Position position)
Creates a JumpScrollBarToolTip for a scroll bar that has a JumpScrollBarModel, with the specified Style and Position.

Parameters:
scrollBar - the scroll bar
style - the style of the tooltip (see ScrollBarToolTip.setStyle() for values)
position - the position of the tooltip (see ScrollBarToolTip.setPosition() for values)
See Also:
ScrollBarToolTip.setStyle
ScrollBarToolTip.setPosition


 
Method Detail

getToolTipText

@Override
protected String getToolTipText(MouseEvent event)
Determine the tooltip text for the every MouseEvent. This implementation returns the current true value, based on the position of the scroll thumb, as an integer percentage of the maximum scrollbar value.

Subclasses should override this method to return the desired tooltip text, for example the row number of a JList or JTable in a scroll pane.

Parameters:
event - the MouseEvent
Returns:
the tooltip text


 

Groovy Documentation