org.tentackle.ui
Class MultiLineToolTipUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ToolTipUI
          extended by javax.swing.plaf.basic.BasicToolTipUI
              extended by org.tentackle.ui.MultiLineToolTipUI

public class MultiLineToolTipUI
extends BasicToolTipUI

Multi-line tooltip UI.
See the static init block in FormHelper.

Notice: the code is derived from xdocletgui.swing.MultiLineToolTipUI.


Constructor Summary
protected MultiLineToolTipUI()
          MultiLineToolTipUI, constructor.
 
Method Summary
static ComponentUI createUI(JComponent c)
          Create the UI component for the given component.
 Dimension getPreferredSize(JComponent c)
          The preferred size for the MultiLineToolTip is the width of the longest row in the tip, and the height of a single row times the number of rows in the tip.
 void paint(Graphics g, JComponent c)
          Paints the ToolTip.
 
Methods inherited from class javax.swing.plaf.basic.BasicToolTipUI
getMaximumSize, getMinimumSize, installDefaults, installListeners, installUI, uninstallDefaults, uninstallListeners, uninstallUI
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiLineToolTipUI

protected MultiLineToolTipUI()
MultiLineToolTipUI, constructor.

Protected so we can be subclassed, but not created by client classes.

Method Detail

createUI

public static ComponentUI createUI(JComponent c)
Create the UI component for the given component. The same UI can be shared for all components, so return our shared instance.

Parameters:
c - The component to create the UI for.
Returns:
Our shared UI component instance.

paint

public void paint(Graphics g,
                  JComponent c)
Paints the ToolTip. Use the current font and colors set for the given component.

Overrides:
paint in class BasicToolTipUI
Parameters:
g - the Graphics context in which to paint
c - the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
See Also:
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)

getPreferredSize

public Dimension getPreferredSize(JComponent c)
The preferred size for the MultiLineToolTip is the width of the longest row in the tip, and the height of a single row times the number of rows in the tip.

Overrides:
getPreferredSize in class BasicToolTipUI
Parameters:
c - the component whose preferred size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
Returns:
the preferred size
See Also:
JComponent.getPreferredSize(), LayoutManager.preferredLayoutSize(java.awt.Container)


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de