Class TipUtil

java.lang.Object
org.fife.ui.rsyntaxtextarea.focusabletip.TipUtil

public final class TipUtil extends Object
Static utility methods for focusable tips. Many of these methods are useful when you want to make a popup JWindow look like a tool tip.
Version:
1.0
Author:
Robert Futrell
  • Method Details

    • getScreenBoundsForPoint

      public static 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 Color getToolTipBackground()
      Returns the default background color to use for tool tip windows.
      Returns:
      The default background color.
      See Also:
    • getToolTipBackground

      public static 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 is null, the tool tip background for the current Look and Feel will be returned.
      Returns:
      The default background color.
      See Also:
    • getToolTipBorder

      public static Border getToolTipBorder()
      Returns the border used by tool tips in this look and feel.
      Returns:
      The border.
      See Also:
    • getToolTipBorder

      public static 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 is null, the tool tip background for the current Look and Feel will be returned.
      Returns:
      The border.
      See Also:
    • tweakTipEditorPane

      public static void tweakTipEditorPane(JEditorPane textArea)
      Tweaks a JEditorPane so it can be used to render the content in a focusable pseudo-tool tip. It is assumed that the editor pane is using an HTMLDocument.
      Parameters:
      textArea - The editor pane to tweak.
    • setFont

      public static void setFont(HTMLDocument doc, Font font, 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.