Class TipUtil


  • final class TipUtil
    extends java.lang.Object
    Static utility methods for homemade tool tips.

    This is blatantly ripped off from RSyntaxTextArea's "FocusableTips" class of the same name, but isn't re-used to prevent a hard dependency on the RSTA library.

    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.Color getToolTipBackground()
      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.
      (package private) static java.awt.Color getToolTipHyperlinkForeground()
      Returns the color to use for hyperlink-style components in tool tips.
      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 tweakTipEditorPane​(javax.swing.JEditorPane textArea)
      Tweaks a JEditorPane so it can be used to render the content in a focusable pseudo-tool tip.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TipUtil

        private TipUtil()
    • Method Detail

      • getToolTipBackground

        public static java.awt.Color getToolTipBackground()
        Returns the default background color to use for tool tip windows.
        Returns:
        The default background color.
      • getToolTipBorder

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

        static java.awt.Color getToolTipHyperlinkForeground()
        Returns the color to use for hyperlink-style components in tool tips. This method will return Color.blue unless it appears that the current LookAndFeel uses light text on a dark background, in which case a brighter alternative is returned.
        Returns:
        The color to use for hyperlinks in tool tips.
        See Also:
        Util.getHyperlinkForeground()
      • 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 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.