Class FocusableTip
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.focusabletip.FocusableTip
-
public class FocusableTip extends java.lang.ObjectA 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classFocusableTip.TextAreaListenerListens for events in a text area.
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.event.HyperlinkListenerhyperlinkListenerprivate java.net.URLimageBaseprivate java.lang.StringlastTextprivate java.awt.DimensionmaxSizeprivate static java.util.ResourceBundleMSGprivate javax.swing.JTextAreatextAreaprivate FocusableTip.TextAreaListenertextAreaListenerprivate java.awt.RectangletipVisibleBoundsThe screen bounds in which the mouse has to stay for the currently displayed tip to stay visible.private TipWindowtipWindowprivate static intX_MARGINMargin from mouse cursor at which to draw focusable tip.private static intY_MARGINMargin from mouse cursor at which to draw focusable tip.
-
Constructor Summary
Constructors Constructor Description FocusableTip(javax.swing.JTextArea textArea, javax.swing.event.HyperlinkListener listener)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcomputeTipVisibleBounds()Compute the bounds in which the user can move the mouse without the tip window disappearing.private voidcreateAndShowTipWindow(java.awt.event.MouseEvent e, java.lang.String text)java.net.URLgetImageBase()Returns the base URL to use when loading images in this focusable tip.java.awt.DimensiongetMaxSize()The maximum size for unfocused tool tips.(package private) static java.lang.StringgetString(java.lang.String key)Returns localized text for the given key.protected voidinvokeLater(java.lang.Runnable r)voidpossiblyDisposeOfTipWindow()Disposes of the focusable tip currently displayed, if any.(package private) voidremoveListeners()voidsetImageBase(java.net.URL url)Sets the base URL to use when loading images in this focusable tip.voidsetMaxSize(java.awt.Dimension maxSize)Sets the maximum size for unfocused tool tips.private voidsetTextArea(javax.swing.JTextArea textArea)voidtoolTipRequested(java.awt.event.MouseEvent e, java.lang.String text)Callback called when this tool tip is requested.
-
-
-
Field Detail
-
textArea
private javax.swing.JTextArea textArea
-
tipWindow
private TipWindow tipWindow
-
imageBase
private java.net.URL imageBase
-
textAreaListener
private FocusableTip.TextAreaListener textAreaListener
-
hyperlinkListener
private javax.swing.event.HyperlinkListener hyperlinkListener
-
lastText
private java.lang.String lastText
-
maxSize
private java.awt.Dimension maxSize
-
tipVisibleBounds
private java.awt.Rectangle tipVisibleBounds
The screen bounds in which the mouse has to stay for the currently displayed tip to stay visible.
-
X_MARGIN
private static final int X_MARGIN
Margin from mouse cursor at which to draw focusable tip.- See Also:
- Constant Field Values
-
Y_MARGIN
private static final int Y_MARGIN
Margin from mouse cursor at which to draw focusable tip.- See Also:
- Constant Field Values
-
MSG
private static final java.util.ResourceBundle MSG
-
-
Method Detail
-
computeTipVisibleBounds
private void computeTipVisibleBounds()
Compute the bounds in which the user can move the mouse without the tip window disappearing.
-
createAndShowTipWindow
private void createAndShowTipWindow(java.awt.event.MouseEvent e, 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)
-
getMaxSize
public java.awt.Dimension getMaxSize()
The maximum size for unfocused tool tips.- Returns:
- The maximum size for unfocused tool tips. A value of
nullwill use a default size. - See Also:
setMaxSize(Dimension)
-
getString
static java.lang.String getString(java.lang.String key)
Returns localized text for the given key.- Parameters:
key- The key into the resource bundle.- Returns:
- The localized text.
-
invokeLater
protected void invokeLater(java.lang.Runnable r)
-
possiblyDisposeOfTipWindow
public void possiblyDisposeOfTipWindow()
Disposes of the focusable tip currently displayed, if any.
-
removeListeners
void removeListeners()
-
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()
-
setMaxSize
public void setMaxSize(java.awt.Dimension maxSize)
Sets the maximum size for unfocused tool tips.- Parameters:
maxSize- The new maximum size. A value ofnullwill cause a default size to be used.- See Also:
getMaxSize()
-
setTextArea
private void setTextArea(javax.swing.JTextArea textArea)
-
toolTipRequested
public void toolTipRequested(java.awt.event.MouseEvent e, java.lang.String text)Callback called when this tool tip is requested.- Parameters:
e- The mouse event that is triggering the tool tip.text- The text to display.
-
-