Class TipUtil
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.focusabletip.TipUtil
-
public final class TipUtil extends java.lang.Object
Static utility methods for focusable tips. Many of these methods are useful when you want to make a popupJWindow
look like a tool tip.- Version:
- 1.0
-
-
Constructor Summary
Constructors Modifier Constructor Description private
TipUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.Rectangle
getScreenBoundsForPoint(int x, int y)
Returns the screen coordinates for the monitor that contains the specified point.static java.awt.Color
getToolTipBackground()
Returns the default background color to use for tool tip windows.static java.awt.Color
getToolTipBackground(RTextArea textArea)
Returns the default background color to use for tool tip windows.static javax.swing.border.Border
getToolTipBorder()
Returns the border used by tool tips in this look and feel.static javax.swing.border.Border
getToolTipBorder(RTextArea textArea)
Returns the border used by tool tips in this look and feel.private static boolean
isDerivedColor(java.awt.Color c)
Returns whether a color is a Nimbus DerivedColor, which is troublesome in that it doesn't use its RGB values (uses HSB instead?) and so querying them is useless.private static boolean
isNimbusLookAndFeel()
Returns whether the Nimbus Look and Feel is installed.static void
setFont(javax.swing.text.html.HTMLDocument doc, java.awt.Font font, java.awt.Color fg)
Sets the default font for an HTML document (e.g., in a tool tip displaying HTML).static void
tweakTipEditorPane(javax.swing.JEditorPane textArea)
Tweaks aJEditorPane
so it can be used to render the content in a focusable pseudo-tool tip.
-
-
-
Method Detail
-
getScreenBoundsForPoint
public static java.awt.Rectangle getScreenBoundsForPoint(int x, int y)
Returns the screen coordinates for the monitor that contains the specified point. This is useful for setups with multiple monitors, to ensure that popup windows are positioned properly.- Parameters:
x
- The x-coordinate, in screen coordinates.y
- The y-coordinate, in screen coordinates.- Returns:
- The bounds of the monitor that contains the specified point.
-
getToolTipBackground
public static java.awt.Color getToolTipBackground()
Returns the default background color to use for tool tip windows.- Returns:
- The default background color.
- See Also:
getToolTipBackground(RTextArea)
,getToolTipBorder()
-
getToolTipBackground
public static java.awt.Color getToolTipBackground(RTextArea textArea)
Returns the default background color to use for tool tip windows.- Parameters:
textArea
- The text area that will be the parent component of the tool tip. If this is non-null
, its background color is taken into consideration when determining the color to return (it will match the editor's background color if necessary to facilitate proper contrast for tool tips rendering code). If this isnull
, the tool tip background for the current Look and Feel will be returned.- Returns:
- The default background color.
- See Also:
getToolTipBackground()
,getToolTipBorder(RTextArea)
-
getToolTipBorder
public static javax.swing.border.Border getToolTipBorder()
Returns the border used by tool tips in this look and feel.- Returns:
- The border.
- See Also:
getToolTipBorder(RTextArea)
,getToolTipBackground()
-
getToolTipBorder
public static javax.swing.border.Border getToolTipBorder(RTextArea textArea)
Returns the border used by tool tips in this look and feel.- Parameters:
textArea
- The text area that will be the parent component of the tool tip. If this is non-null
, its background color is taken into consideration when determining the color to return (it will coordinate with the editor's background color if necessary to facilitate proper contrast for tool tips rendering code). If this isnull
, the tool tip background for the current Look and Feel will be returned.- Returns:
- The border.
- See Also:
getToolTipBorder()
,getToolTipBackground(RTextArea)
-
isDerivedColor
private static boolean isDerivedColor(java.awt.Color c)
Returns whether a color is a Nimbus DerivedColor, which is troublesome in that it doesn't use its RGB values (uses HSB instead?) and so querying them is useless.- Parameters:
c
- The color to check.- Returns:
- Whether it is a DerivedColor.
-
isNimbusLookAndFeel
private static boolean isNimbusLookAndFeel()
Returns whether the Nimbus Look and Feel is installed.- Returns:
- Whether the current LAF is Nimbus.
-
tweakTipEditorPane
public static void tweakTipEditorPane(javax.swing.JEditorPane textArea)
Tweaks aJEditorPane
so it can be used to render the content in a focusable pseudo-tool tip. It is assumed that the editor pane is using anHTMLDocument
.- Parameters:
textArea
- The editor pane to tweak.
-
setFont
public static void setFont(javax.swing.text.html.HTMLDocument doc, java.awt.Font font, java.awt.Color fg)
Sets the default font for an HTML document (e.g., in a tool tip displaying HTML). This is here because when rendering HTML,setFont()
is not honored.- Parameters:
doc
- The document to modify.font
- The font to use.fg
- The default foreground color.
-
-