com.alee.managers.tooltip
Class WebCustomTooltip

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.alee.managers.tooltip.WebCustomTooltip
All Implemented Interfaces:
ShapeProvider, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class WebCustomTooltip
extends javax.swing.JComponent
implements ShapeProvider

User: mgarin Date: 10.12.10 Time: 20:47

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
WebCustomTooltip(java.awt.Component component, javax.swing.Icon icon, java.lang.String tooltip)
           
WebCustomTooltip(java.awt.Component component, javax.swing.Icon icon, java.lang.String tooltip, boolean showHotkey)
           
WebCustomTooltip(java.awt.Component component, javax.swing.Icon icon, java.lang.String tooltip, TooltipWay tooltipWay)
           
WebCustomTooltip(java.awt.Component component, javax.swing.Icon icon, java.lang.String tooltip, TooltipWay tooltipWay, boolean showHotkey)
           
WebCustomTooltip(java.awt.Component component, javax.swing.JComponent tooltip)
           
WebCustomTooltip(java.awt.Component component, javax.swing.JComponent tooltip, boolean showHotkey)
           
WebCustomTooltip(java.awt.Component component, javax.swing.JComponent tooltip, TooltipWay tooltipWay)
           
WebCustomTooltip(java.awt.Component component, javax.swing.JComponent tooltip, TooltipWay tooltipWay, boolean showHotkey)
           
WebCustomTooltip(java.awt.Component component, java.lang.String tooltip)
           
WebCustomTooltip(java.awt.Component component, java.lang.String tooltip, boolean showHotkey)
           
WebCustomTooltip(java.awt.Component component, java.lang.String tooltip, TooltipWay tooltipWay)
           
WebCustomTooltip(java.awt.Component component, java.lang.String tooltip, TooltipWay tooltipWay, boolean showHotkey)
           
 
Method Summary
 void addTooltipListener(TooltipListener listener)
          Tooltip listeners
 void applyComponentOrientation(java.awt.ComponentOrientation o)
          Close tooltip on orientation change to avoid location problems
 void closeTooltip()
          Tooltip hide
static WebLabel createDefaultComponent(javax.swing.Icon icon, java.lang.String tooltip)
           
 void destroyTooltip()
          Tooltip destroy
 TooltipWay getActualDisplayWay()
          Calculated display way
 java.awt.Color getBorderColor()
          Tooltip border color
 java.awt.Color getBottomBgColor()
          Tooltip bottom background color
 java.awt.Component getComponent()
          Component to which this tooltip attached
 int getContentSpacing()
          Tooltip spacing between sides and content
 java.awt.Point getDisplayLocation()
          Custom display location relative to component
 TooltipWay getDisplayWay()
          Tooltip display way
 java.awt.Color getHotkeyColor()
          Hotkey text color
 int getHotkeyLocation()
          Hotkey display location
 java.lang.String getId()
          Tooltip unique id
 int getLeftRightSpacing()
          Additional tooltip content left/right spacing
 int getRound()
          Tooltip corners rounding
 java.awt.Color getShadeColor()
          Tooltip shade color
 int getShadeWidth()
          Tooltip shade width
 java.awt.Color getTextColor()
          Tooltip text color
 javax.swing.JComponent getTooltip()
          Tooltip component
 java.awt.Color getTopBgColor()
          Tooltip top background color
 float getTrasparency()
          Tooltip background transparency
 int getWindowSideSpacing()
          Minimal spacing between tooltip and window edge
 boolean isDefaultCloseBehavior()
          Default tooltip close behavior
 boolean isShowHotkey()
          Should display component hotkey on tooltip or not
protected  void paintComponent(java.awt.Graphics g)
          Tooltip background painting
 java.awt.Shape provideShape()
          Shape provider
 void removeAllTooltipListeners()
           
 void removeTooltipListener(TooltipListener listener)
           
 void setBorderColor(java.awt.Color borderColor)
           
 void setBottomBgColor(java.awt.Color bottomBgColor)
           
 void setContentSpacing(int contentSpacing)
           
 void setDefaultCloseBehavior(boolean defaultCloseBehavior)
           
 void setDisplayLocation(int x, int y)
           
 void setDisplayLocation(java.awt.Point displayLocation)
           
 void setDisplayWay(TooltipWay displayWay)
           
 void setHotkeyColor(java.awt.Color hotkeyColor)
           
 void setHotkeyLocation(int hotkeyLocation)
           
 void setLeftRightSpacing(int leftRightSpacing)
           
 void setRound(int round)
           
 void setShadeColor(java.awt.Color shadeColor)
           
 void setShadeWidth(int shadeWidth)
           
 void setShowHotkey(boolean showHotkey)
           
 void setTextColor(java.awt.Color textColor)
           
 void setTooltip(javax.swing.JComponent tooltip)
           
 void setTooltip(java.lang.String tooltip)
           
 void setTopBgColor(java.awt.Color topBgColor)
           
 void setTrasparency(float trasparency)
           
 void setWindowSideSpacing(int windowSideSpacing)
           
 void updateBorder()
          Tooltip layout update
 void updateLocation()
          Tooltip location on glasspane update
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        java.lang.String tooltip)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        javax.swing.Icon icon,
                        java.lang.String tooltip)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        java.lang.String tooltip,
                        TooltipWay tooltipWay)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        javax.swing.Icon icon,
                        java.lang.String tooltip,
                        TooltipWay tooltipWay)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        java.lang.String tooltip,
                        boolean showHotkey)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        javax.swing.Icon icon,
                        java.lang.String tooltip,
                        boolean showHotkey)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        java.lang.String tooltip,
                        TooltipWay tooltipWay,
                        boolean showHotkey)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        javax.swing.Icon icon,
                        java.lang.String tooltip,
                        TooltipWay tooltipWay,
                        boolean showHotkey)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        javax.swing.JComponent tooltip)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        javax.swing.JComponent tooltip,
                        TooltipWay tooltipWay)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        javax.swing.JComponent tooltip,
                        boolean showHotkey)

WebCustomTooltip

public WebCustomTooltip(java.awt.Component component,
                        javax.swing.JComponent tooltip,
                        TooltipWay tooltipWay,
                        boolean showHotkey)
Method Detail

closeTooltip

public void closeTooltip()
Tooltip hide


destroyTooltip

public void destroyTooltip()
Tooltip destroy


getActualDisplayWay

public TooltipWay getActualDisplayWay()
Calculated display way


updateBorder

public void updateBorder()
Tooltip layout update


applyComponentOrientation

public void applyComponentOrientation(java.awt.ComponentOrientation o)
Close tooltip on orientation change to avoid location problems

Overrides:
applyComponentOrientation in class java.awt.Container

getContentSpacing

public int getContentSpacing()
Tooltip spacing between sides and content


setContentSpacing

public void setContentSpacing(int contentSpacing)

getLeftRightSpacing

public int getLeftRightSpacing()
Additional tooltip content left/right spacing


setLeftRightSpacing

public void setLeftRightSpacing(int leftRightSpacing)

updateLocation

public void updateLocation()
Tooltip location on glasspane update


getDisplayLocation

public java.awt.Point getDisplayLocation()
Custom display location relative to component


setDisplayLocation

public void setDisplayLocation(int x,
                               int y)

setDisplayLocation

public void setDisplayLocation(java.awt.Point displayLocation)

getWindowSideSpacing

public int getWindowSideSpacing()
Minimal spacing between tooltip and window edge


setWindowSideSpacing

public void setWindowSideSpacing(int windowSideSpacing)

getRound

public int getRound()
Tooltip corners rounding


setRound

public void setRound(int round)

getShadeWidth

public int getShadeWidth()
Tooltip shade width


setShadeWidth

public void setShadeWidth(int shadeWidth)

getShadeColor

public java.awt.Color getShadeColor()
Tooltip shade color


setShadeColor

public void setShadeColor(java.awt.Color shadeColor)

getComponent

public java.awt.Component getComponent()
Component to which this tooltip attached


getId

public java.lang.String getId()
Tooltip unique id


getTooltip

public javax.swing.JComponent getTooltip()
Tooltip component


setTooltip

public void setTooltip(java.lang.String tooltip)

setTooltip

public void setTooltip(javax.swing.JComponent tooltip)

getDisplayWay

public TooltipWay getDisplayWay()
Tooltip display way


setDisplayWay

public void setDisplayWay(TooltipWay displayWay)

isShowHotkey

public boolean isShowHotkey()
Should display component hotkey on tooltip or not


setShowHotkey

public void setShowHotkey(boolean showHotkey)

getHotkeyLocation

public int getHotkeyLocation()
Hotkey display location


setHotkeyLocation

public void setHotkeyLocation(int hotkeyLocation)

isDefaultCloseBehavior

public boolean isDefaultCloseBehavior()
Default tooltip close behavior


setDefaultCloseBehavior

public void setDefaultCloseBehavior(boolean defaultCloseBehavior)

getTextColor

public java.awt.Color getTextColor()
Tooltip text color


setTextColor

public void setTextColor(java.awt.Color textColor)

getHotkeyColor

public java.awt.Color getHotkeyColor()
Hotkey text color


setHotkeyColor

public void setHotkeyColor(java.awt.Color hotkeyColor)

getTopBgColor

public java.awt.Color getTopBgColor()
Tooltip top background color


setTopBgColor

public void setTopBgColor(java.awt.Color topBgColor)

getBottomBgColor

public java.awt.Color getBottomBgColor()
Tooltip bottom background color


setBottomBgColor

public void setBottomBgColor(java.awt.Color bottomBgColor)

getBorderColor

public java.awt.Color getBorderColor()
Tooltip border color


setBorderColor

public void setBorderColor(java.awt.Color borderColor)

getTrasparency

public float getTrasparency()
Tooltip background transparency


setTrasparency

public void setTrasparency(float trasparency)

provideShape

public java.awt.Shape provideShape()
Shape provider

Specified by:
provideShape in interface ShapeProvider
Returns:
component shape

paintComponent

protected void paintComponent(java.awt.Graphics g)
Tooltip background painting

Overrides:
paintComponent in class javax.swing.JComponent

addTooltipListener

public void addTooltipListener(TooltipListener listener)
Tooltip listeners


removeTooltipListener

public void removeTooltipListener(TooltipListener listener)

removeAllTooltipListeners

public void removeAllTooltipListeners()

createDefaultComponent

public static WebLabel createDefaultComponent(javax.swing.Icon icon,
                                              java.lang.String tooltip)