javax.swing.plaf.metal

Class MetalToolTipUI

public class MetalToolTipUI extends BasicToolTipUI

A UI delegate for the {@link JToolTip} component.
Field Summary
static intpadSpaceBetweenStrings
The amount of space between the tool tip text and the accelerator description (if visible).
Constructor Summary
MetalToolTipUI()
Constructs a new instance of MetalToolTipUI.
Method Summary
static ComponentUIcreateUI(JComponent component)
Returns a shared instance of the MetalToolTipUI class.
StringgetAcceleratorString()
Returns a string representing the accelerator key (if there is one) for the component that the tool tip belongs to.
DimensiongetPreferredSize(JComponent c)
Returns the preferred size for the {@link JToolTip} component.
voidinstallUI(JComponent c)
Installs the UI for the specified component (a {@link JToolTip}).
protected booleanisAcceleratorHidden()
Returns true if the accelerator string is hidden, and false otherwise.
voidpaint(Graphics g, JComponent c)
Paints the tool tip.
voiduninstallUI(JComponent c)
Clears the defaults set in {@link #installUI(JComponent)}.

Field Detail

padSpaceBetweenStrings

public static final int padSpaceBetweenStrings
The amount of space between the tool tip text and the accelerator description (if visible).

Constructor Detail

MetalToolTipUI

public MetalToolTipUI()
Constructs a new instance of MetalToolTipUI.

Method Detail

createUI

public static ComponentUI createUI(JComponent component)
Returns a shared instance of the MetalToolTipUI class. Although this UI delegate does maintain state information, there is never more than one tool tip visible, so it is OK to use a shared instance.

Parameters: component the component (a {@link JToolTip}).

Returns: A shared instance of the MetalToolTipUI class.

getAcceleratorString

public String getAcceleratorString()
Returns a string representing the accelerator key (if there is one) for the component that the tool tip belongs to.

Returns: A string representing the accelerator key.

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Returns the preferred size for the {@link JToolTip} component.

Parameters: c the component (a {@link JToolTip}).

Returns: The preferred size.

installUI

public void installUI(JComponent c)
Installs the UI for the specified component (a {@link JToolTip}).

Parameters: c the {@link JToolTip} component.

isAcceleratorHidden

protected boolean isAcceleratorHidden()
Returns true if the accelerator string is hidden, and false otherwise. This setting is controlled by the ToolTip.hideAccelerator entry in the UI defaults table.

Returns: A boolean.

paint

public void paint(Graphics g, JComponent c)
Paints the tool tip.

Parameters: g the graphics context. c the {@link JToolTip} component.

uninstallUI

public void uninstallUI(JComponent c)
Clears the defaults set in {@link #installUI(JComponent)}.

Parameters: c the component.