Groovy Documentation

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

java.lang.Object
  com.wordpress.tipsforjava.swing.ScrollBarToolTip
All Implemented Interfaces:
MouseListener, MouseMotionListener

public class ScrollBarToolTip
extends Object

The ScrollBarToolTip class allows you to simulate the display of a tooltip as the scrollbar thumb is being dragged. This may be usefull when scrolling through a large amount of data in a scrollpane. The STYLE of the tooltip can be specified. A "fixed" style implies that the tooltip is fixed at a certain spot when the mouse is pressed on the toolbar thumb. A "floating" style implies that the tooltip will move as the toolbar thumb is dragged. The POSITION of the tooltip indicates how the tooltip is placed relative to the scrollbar. The default tooltip text shows the relationship of the current position of the scrollbar to the maximum scrollbar value as a percentage.

Authors:
Rob Camick
Darryl Burke


Nested Class Summary
enum ScrollBarToolTip.Position

enum ScrollBarToolTip.Style

 
Field Summary
private static int ADJUSTMENT

private static int GAP

private Popup popup

private ScrollBarToolTip.Position position

private Point pressedPoint

private JScrollBar scrollBar

private ScrollBarToolTip.Style style

private JToolTip toolTip

 
Constructor Summary
ScrollBarToolTip(JScrollBar scrollBar)

Convenience constructor with a Style enum of FIXED_PRESSED and a Position enum of INSIDE.

ScrollBarToolTip(JScrollBar scrollBar, ScrollBarToolTip.Style style, ScrollBarToolTip.Position position)

Create a ScrollBarToolTip

 
Method Summary
private int getHorizontalX(MouseEvent e)

private int getHorizontalY(MouseEvent e)

ScrollBarToolTip.Position getPosition()

Get the Position tooltip

ScrollBarToolTip.Style getStyle()

Get the Style tooltip

protected Point getToolTipLocation(MouseEvent event)

protected String getToolTipText(MouseEvent event)

private int getVerticalX(MouseEvent e)

private int getVerticalY(MouseEvent e)

void mouseClicked(MouseEvent e)

void mouseDragged(MouseEvent e)

Update the tooltip text and/or position as the mouse is dragged

void mouseEntered(MouseEvent e)

void mouseExited(MouseEvent e)

void mouseMoved(MouseEvent e)

void mousePressed(MouseEvent e)

void mouseReleased(MouseEvent e)

void setPosition(ScrollBarToolTip.Position position)

Set the Position of the tooltip relative to the scrollbar.

void setStyle(ScrollBarToolTip.Style style)

Set the Style of the tooltip.

protected void showToolTip(MouseEvent event)

ScrollBarToolTip valueOf(String name)

Returns the enum constant of this type with the specified name.

ScrollBarToolTip valueOf(String name)

Returns the enum constant of this type with the specified name.

ScrollBarToolTip[] values()

Returns an array containing the constants of this enum type, in the order they are declared.

ScrollBarToolTip[] values()

Returns an array containing the constants of this enum type, in the order they are declared.

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

Field Detail

ADJUSTMENT

private static final int ADJUSTMENT


GAP

private static final int GAP


popup

private Popup popup


position

private ScrollBarToolTip.Position position


pressedPoint

private Point pressedPoint


scrollBar

private JScrollBar scrollBar


style

private ScrollBarToolTip.Style style


toolTip

private JToolTip toolTip


 
Constructor Detail

ScrollBarToolTip

public ScrollBarToolTip(JScrollBar scrollBar)
Convenience constructor with a Style enum of FIXED_PRESSED and a Position enum of INSIDE.
Parameters:
scrollBar - the JScrollBar the tooltip will be displayed for


ScrollBarToolTip

public ScrollBarToolTip(JScrollBar scrollBar, ScrollBarToolTip.Style style, ScrollBarToolTip.Position position)
Create a ScrollBarToolTip
Parameters:
scrollBar - the JScrollBar the tooltip will be displayed for
style - the style of the tooltip (see setStyle() for values)
position - the position of the tooltip (see setPosition() for values)


 
Method Detail

getHorizontalX

private int getHorizontalX(MouseEvent e)


getHorizontalY

private int getHorizontalY(MouseEvent e)


getPosition

public ScrollBarToolTip.Position getPosition()
Get the Position tooltip
Returns:
the tooltip Position


getStyle

public ScrollBarToolTip.Style getStyle()
Get the Style tooltip
Returns:
the tooltip Style


getToolTipLocation

protected Point getToolTipLocation(MouseEvent event)


getToolTipText

protected String getToolTipText(MouseEvent event)


getVerticalX

private int getVerticalX(MouseEvent e)


getVerticalY

private int getVerticalY(MouseEvent e)


mouseClicked

de
	public
public void mouseClicked(MouseEvent e)


mouseDragged

de
	public
public void mouseDragged(MouseEvent e)
Update the tooltip text and/or position as the mouse is dragged


mouseEntered

de
	public
public void mouseEntered(MouseEvent e)


mouseExited

de
	public
public void mouseExited(MouseEvent e)


mouseMoved

de
	public
public void mouseMoved(MouseEvent e)


mousePressed

de
	public
public void mousePressed(MouseEvent e)


mouseReleased

de
	public
public void mouseReleased(MouseEvent e)


setPosition

public void setPosition(ScrollBarToolTip.Position position)
Set the Position of the tooltip relative to the scrollbar. The valid Positions are:
Parameters:
position - the Position of the tooltip


setStyle

public void setStyle(ScrollBarToolTip.Style style)
Set the Style of the tooltip. The valid Styles are:
Parameters:
style - the Style of the tooltip


showToolTip

protected void showToolTip(MouseEvent event)


valueOf

ScrollBarToolTip valueOf(String name)
Returns the enum constant of this type with the specified name.


valueOf

ScrollBarToolTip valueOf(String name)
Returns the enum constant of this type with the specified name.


values

ScrollBarToolTip[] values()
Returns an array containing the constants of this enum type, in the order they are declared.


values

ScrollBarToolTip[] values()
Returns an array containing the constants of this enum type, in the order they are declared.


 

Groovy Documentation