javax.swing.plaf.metal
Class MetalToolTipUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ToolTipUI
          extended by javax.swing.plaf.basic.BasicToolTipUI
              extended by javax.swing.plaf.metal.MetalToolTipUI

public class MetalToolTipUI
extends BasicToolTipUI

A UI delegate for the JToolTip component.


Field Summary
static int padSpaceBetweenStrings
          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 ComponentUI createUI(JComponent component)
          Returns a shared instance of the MetalToolTipUI class.
 String getAcceleratorString()
          Returns a string representing the accelerator key (if there is one) for the component that the tool tip belongs to.
 Dimension getPreferredSize(JComponent c)
          Returns the preferred size for the JToolTip component.
 void installUI(JComponent c)
          Installs the UI for the specified component (a JToolTip).
protected  boolean isAcceleratorHidden()
          Returns true if the accelerator string is hidden, and false otherwise.
 void paint(Graphics g, JComponent c)
          Paints the tool tip.
 void uninstallUI(JComponent c)
          Clears the defaults set in installUI(JComponent).
 
Methods inherited from class javax.swing.plaf.basic.BasicToolTipUI
getMaximumSize, getMinimumSize, installDefaults, installListeners, uninstallDefaults, uninstallListeners
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

padSpaceBetweenStrings

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

See Also:
Constant Field Values
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 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.

installUI

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

Overrides:
installUI in class BasicToolTipUI
Parameters:
c - the JToolTip component.
See Also:
ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

uninstallUI

public void uninstallUI(JComponent c)
Clears the defaults set in installUI(JComponent).

Overrides:
uninstallUI in class BasicToolTipUI
Parameters:
c - the component.
See Also:
ComponentUI.installUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

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.

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Returns the preferred size for the JToolTip component.

Overrides:
getPreferredSize in class BasicToolTipUI
Parameters:
c - the component (a JToolTip).
Returns:
The preferred size.

paint

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

Overrides:
paint in class BasicToolTipUI
Parameters:
g - the graphics context.
c - the JToolTip component.