Package com.formdev.flatlaf.ui
Class FlatHTML
- java.lang.Object
-
- com.formdev.flatlaf.ui.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(package private) static java.util.function.BiConsumer<javax.swing.JComponent,java.lang.String>testUpdateRenderer
-
Constructor Summary
Constructors Modifier Constructor Description privateFlatHTML()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidclearViewCaches(javax.swing.text.View view)Clears cached values in view so that CSS changes take effect.static java.beans.PropertyChangeListenercreatePropertyChangeListener(java.beans.PropertyChangeListener superListener)private static intindexOfTag(java.lang.String html, java.lang.String tag, boolean endIndex)Returns start or end index of a HTML tag.static voidpropertyChange(java.beans.PropertyChangeEvent e)InvokesupdateRendererCSSFontBaseSize(JComponent)forBasicHTML.propertyKeyproperty change events, which are fired whenBasicHTML.updateRenderer(JComponent, String)updates the HTML view.static voidupdateRendererCSSFontBaseSize(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 voidupdateRendererCSSForeground(javax.swing.text.View view, java.awt.Color foreground)Updates foreground in style sheet of the HTML view.private static booleanusesAbsoluteSizeKeywordForFontSize(javax.swing.text.View view)Checks whether view uses "absolute-size" keywords (e.g.
-
-
-
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).
-
indexOfTag
private static int indexOfTag(java.lang.String html, java.lang.String tag, boolean endIndex)Returns start or end index of a HTML tag. Checks only for leading '<' character and (case-ignore) tag name.
-
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)
InvokesupdateRendererCSSFontBaseSize(JComponent)forBasicHTML.propertyKeyproperty change events, which are fired whenBasicHTML.updateRenderer(JComponent, String)updates the HTML view.
-
-