Class FlatHTML


  • public class FlatHTML
    extends java.lang.Object
    Since:
    3.5
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Set<java.lang.String> absoluteSizeKeywordsSet  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private FlatHTML()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static void clearViewCaches​(javax.swing.text.View view)
      Clears cached values in view so that CSS changes take effect.
      static java.beans.PropertyChangeListener createPropertyChangeListener​(java.beans.PropertyChangeListener superListener)  
      static void propertyChange​(java.beans.PropertyChangeEvent e)
      Invokes updateRendererCSSFontBaseSize(JComponent) for BasicHTML.propertyKey property change events, which are fired when BasicHTML.updateRenderer(JComponent, String) updates the HTML view.
      static void updateRendererCSSFontBaseSize​(javax.swing.JComponent c)
      Adds CSS rule BASE_SIZE to the style sheet of the HTML view, which re-calculates font sizes based on current component font size.
      static void updateRendererCSSForeground​(javax.swing.text.View view, java.awt.Color foreground)
      Updates foreground in style sheet of the HTML view.
      private static boolean usesAbsoluteSizeKeywordForFontSize​(javax.swing.text.View view)
      Checks whether view uses "absolute-size" keywords (e.g.
      • Methods inherited from class java.lang.Object

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

      • absoluteSizeKeywordsSet

        private static final java.util.Set<java.lang.String> absoluteSizeKeywordsSet
    • Constructor Detail

      • FlatHTML

        private FlatHTML()
    • Method Detail

      • updateRendererCSSFontBaseSize

        public static void updateRendererCSSFontBaseSize​(javax.swing.JComponent c)
        Adds CSS rule BASE_SIZE to the style sheet of the HTML view, which re-calculates font sizes based on current component font size. This is necessary for "absolute-size" keywords (e.g. "x-large") for "font-size" attributes in default style sheet (see javax/swing/text/html/default.css). See also CSS font-size.

        This method should be invoked after BasicHTML.updateRenderer(JComponent, String).

      • usesAbsoluteSizeKeywordForFontSize

        private static boolean usesAbsoluteSizeKeywordForFontSize​(javax.swing.text.View view)
        Checks whether view uses "absolute-size" keywords (e.g. "x-large") for font-size (see javax/swing/text/html/default.css).
      • updateRendererCSSForeground

        public static void updateRendererCSSForeground​(javax.swing.text.View view,
                                                       java.awt.Color foreground)
        Updates foreground in style sheet of the HTML view. Adds "body { color: #<foreground-hex>; }"
      • clearViewCaches

        private static void clearViewCaches​(javax.swing.text.View view)
        Clears cached values in view so that CSS changes take effect.
      • createPropertyChangeListener

        public static java.beans.PropertyChangeListener createPropertyChangeListener​(java.beans.PropertyChangeListener superListener)
      • propertyChange

        public static void propertyChange​(java.beans.PropertyChangeEvent e)
        Invokes updateRendererCSSFontBaseSize(JComponent) for BasicHTML.propertyKey property change events, which are fired when BasicHTML.updateRenderer(JComponent, String) updates the HTML view.