Class CSS

java.lang.Object
com.inet.html.css.CSS
Direct Known Subclasses:
CSS.UnknownAttribute

public class CSS extends Object
Contains all implemented CSS attributes and additional setters
  • Constructor Details

    • CSS

      public CSS()
  • Method Details

    • getAttribute

      public static final CSS.Attribute getAttribute(String name)
      Get the CSS Attribute with the same name.
      Parameters:
      name - the lower case name
      Returns:
      the Attribute or null
    • setTextColor

      public static void setTextColor(MutableAttributeSet a, Color color)
      Correctly sets the CSS.COLOR attribute
      Parameters:
      a - The attribute set to modify
      color - The color to set
    • setFontSizePT

      public static void setFontSizePT(MutableAttributeSet a, int size)
      Correctly sets the CSS.FONT_SIZE attribute
      Parameters:
      a - The attribute set to modify
      size - the size in PT to set
    • setFontSizePT

      public static void setFontSizePT(MutableAttributeSet a, float size)
      Correctly sets the CSS.FONT_SIZE attribute
      Parameters:
      a - The attribute set to modify
      size - the size in PT to set
    • setFontSize

      public static void setFontSize(MutableAttributeSet a, int size)
      Correctly sets the CSS.FONT_SIZE attribute
      Parameters:
      a - The attribute set to modify
      size - the size in pixels to set
    • setFontWeight

      public static void setFontWeight(MutableAttributeSet a, boolean bold)
      Correctly sets the CSS.FONT_WEIGHT attribute
      Parameters:
      a - The attribute set to modify
      bold - set to true, to make the font bold
    • setFontStyle

      public static void setFontStyle(MutableAttributeSet a, boolean italic)
      Correctly sets the CSS.FONT_STYLE attribute
      Parameters:
      a - The attribute set to modify
      italic - set to true, to make the font italics
    • setTextDecoration

      public static void setTextDecoration(MutableAttributeSet a, int decoration)
      Correctly sets the CSS.TEXT_DECORATION attribute
      Parameters:
      a - The attribute set to modify
      decoration - The TextDecoration constant
    • setFontFamily

      public static void setFontFamily(MutableAttributeSet a, String family)
      Correctly sets the CSS.FONT_FAMILY attribute
      Parameters:
      a - The attribute set to modify
      family - The name of the font or font family to set
    • isBold

      public static boolean isBold(Element element)
      Checks whether the element has font weight bold set directly or by inherit
      Parameters:
      element - the element to check - in most cases the character element
      Returns:
      true, if the font at this element level would be displayed bold
    • isItalic

      public static boolean isItalic(Element element)
      Checks whether the element has font style italic or oblique set directly or by inherit
      Parameters:
      element - the element to check - in most cases the character element
      Returns:
      true, if the font at this element level would be displayed italic
    • isUnderline

      public static boolean isUnderline(Element element)
      Checks whether the element has text decoration underline set directly or by inherit
      Parameters:
      element - the element to check - in most cases the character element
      Returns:
      true, if the font at this element level would be displayed underlined
    • setMarginLeft

      public static void setMarginLeft(MutableAttributeSet a, int pixels)
      Correctly sets the CSS.MARGIN_LEFT attribute
      Parameters:
      a - The attribute set to modify
      pixels - the margin width in pixel