Class FocusableTip
java.lang.Object
org.nuiton.jaxx.widgets.extra.tooltip.FocusableTip
public class FocusableTip
extends java.lang.Object
A focusable tool tip, similar to those found in Eclipse. The user
can click in the tip and it becomes a "real," resizable window.
- Version:
- 1.0
- Author:
- Robert Futrell
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classFocusableTip.AttachedComponentListener -
Field Summary
Fields Modifier and Type Field Description protected javax.swing.JComponentattachedComponentprotected FocusableTip.AttachedComponentListenerattachedComponentListenerstatic java.lang.StringDUMMY_TOOL_TIPprotected intheightHeight with default value.protected javax.swing.event.HyperlinkListenerhyperlinkListenerprotected java.net.URLimageBaseprotected java.awt.ComponentlastComponentprotected java.lang.StringlastTextprotected static intMARGINMargin from mouse cursor at which to draw focusable tip.protected booleanshowCopyContextMenuprotected java.awt.RectangletipVisibleBoundsThe screen bounds in which the mouse has to stay for the currently displayed tip to stay visible.protected TipWindowtipWindowprotected intwidthWidth with default value. -
Constructor Summary
Constructors Constructor Description FocusableTip(javax.swing.JComponent attachedComponent)FocusableTip constructorFocusableTip(javax.swing.JComponent attachedComponent, boolean showCopyContextMenu)FocusableTip constructorFocusableTip(javax.swing.JComponent attachedComponent, javax.swing.event.HyperlinkListener listener)FocusableTip constructorFocusableTip(javax.swing.JComponent attachedComponent, javax.swing.event.HyperlinkListener listener, boolean showCopyContextMenu)FocusableTip constructor -
Method Summary
Modifier and Type Method Description protected voidcomputeTipVisibleBounds()Compute the bounds in which the user can move the mouse without the tip window disappearing.protected voidcreateAndShowTipWindow(java.awt.event.MouseEvent e, java.awt.Component component, java.lang.String text)java.net.URLgetImageBase()Returns the base URL to use when loading images in this focusable tip.TipWindowgetTipWindows()GetTipWindowdisplayedvoidpossiblyDisposeOfTipWindow()Disposes of the focusable tip currently displayed, if any.protected voidsetAttachedComponent(javax.swing.JComponent attachedComponent)voidsetImageBase(java.net.URL url)Sets the base URL to use when loading images in this focusable tip.voidsetSize(int width, int height)Change tip size.voidtoolTipRequested(java.awt.event.MouseEvent e, java.awt.Component component)voidtoolTipRequested(java.awt.event.MouseEvent e, java.lang.String text)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
DUMMY_TOOL_TIP
public static final java.lang.String DUMMY_TOOL_TIP- See Also:
- Constant Field Values
-
attachedComponent
protected javax.swing.JComponent attachedComponent -
tipWindow
-
imageBase
protected java.net.URL imageBase -
attachedComponentListener
-
hyperlinkListener
protected javax.swing.event.HyperlinkListener hyperlinkListener -
lastText
protected java.lang.String lastText -
lastComponent
protected java.awt.Component lastComponent -
showCopyContextMenu
protected boolean showCopyContextMenu -
width
protected int widthWidth with default value. -
height
protected int heightHeight with default value. -
tipVisibleBounds
protected java.awt.Rectangle tipVisibleBoundsThe screen bounds in which the mouse has to stay for the currently displayed tip to stay visible. -
MARGIN
protected static final int MARGINMargin from mouse cursor at which to draw focusable tip.- See Also:
- Constant Field Values
-
-
Constructor Details
-
FocusableTip
public FocusableTip(javax.swing.JComponent attachedComponent)FocusableTip constructor- Parameters:
attachedComponent- component to attach
-
FocusableTip
public FocusableTip(javax.swing.JComponent attachedComponent, javax.swing.event.HyperlinkListener listener)FocusableTip constructor- Parameters:
attachedComponent- component to attachlistener- hyper link listener to add
-
FocusableTip
public FocusableTip(javax.swing.JComponent attachedComponent, boolean showCopyContextMenu)FocusableTip constructor- Parameters:
attachedComponent- component to attachshowCopyContextMenu- to show copy context menu
-
FocusableTip
public FocusableTip(javax.swing.JComponent attachedComponent, javax.swing.event.HyperlinkListener listener, boolean showCopyContextMenu)FocusableTip constructor- Parameters:
attachedComponent- component to attachlistener- hyper link listener to addshowCopyContextMenu- to show copy context menu
-
-
Method Details
-
setSize
public void setSize(int width, int height)Change tip size.- Parameters:
width- widthheight- height
-
getTipWindows
GetTipWindowdisplayed- Returns:
- TipWindow displayed
-
computeTipVisibleBounds
protected void computeTipVisibleBounds()Compute the bounds in which the user can move the mouse without the tip window disappearing. -
createAndShowTipWindow
protected void createAndShowTipWindow(java.awt.event.MouseEvent e, java.awt.Component component, java.lang.String text) -
getImageBase
public java.net.URL getImageBase()Returns the base URL to use when loading images in this focusable tip.- Returns:
- The base URL to use.
- See Also:
setImageBase(URL)
-
possiblyDisposeOfTipWindow
public void possiblyDisposeOfTipWindow()Disposes of the focusable tip currently displayed, if any. -
setImageBase
public void setImageBase(java.net.URL url)Sets the base URL to use when loading images in this focusable tip.- Parameters:
url- The base URL to use.- See Also:
getImageBase()
-
setAttachedComponent
protected void setAttachedComponent(javax.swing.JComponent attachedComponent) -
toolTipRequested
public void toolTipRequested(java.awt.event.MouseEvent e, java.lang.String text) -
toolTipRequested
public void toolTipRequested(java.awt.event.MouseEvent e, java.awt.Component component)
-