Enum LengthUnit

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<LengthUnit>

    public enum LengthUnit
    extends java.lang.Enum<LengthUnit>
    CSS length unit type.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      Centimeter
      Centimeter (cm)
      FontEm
      The relative font size (em)
      FontEx
      The height of an 'x' in the font (ex)
      Inch
      Inch (in)
      Millimeter
      Millimeter (mm)
      Percentage
      Percentage (meaning context-sensitive) (%)
      Pica
      Pica (12 Point) (pc)
      Pixel
      Pixel, relative to canvas resolution (px)
      Point
      Point (1/72 Inch) (pt)
      ViewportHeight
      A percentage of the viewport's height (vh)
      ViewportMax
      A percentage of the viewport's larger dimension (vmax)
      ViewportMin
      A percentage of the viewport's smaller dimension (vmin)
      ViewportWidth
      A percentage of the viewport's width (vw)
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getValue()
      Returns the numerical representation of this enum.
      static LengthUnit valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static LengthUnit[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • FontEm

        public static final LengthUnit FontEm
        The relative font size (em)
      • FontEx

        public static final LengthUnit FontEx
        The height of an 'x' in the font (ex)
      • Pixel

        public static final LengthUnit Pixel
        Pixel, relative to canvas resolution (px)
      • Inch

        public static final LengthUnit Inch
        Inch (in)
      • Centimeter

        public static final LengthUnit Centimeter
        Centimeter (cm)
      • Millimeter

        public static final LengthUnit Millimeter
        Millimeter (mm)
      • Point

        public static final LengthUnit Point
        Point (1/72 Inch) (pt)
      • Pica

        public static final LengthUnit Pica
        Pica (12 Point) (pc)
      • Percentage

        public static final LengthUnit Percentage
        Percentage (meaning context-sensitive) (%)
      • ViewportWidth

        public static final LengthUnit ViewportWidth
        A percentage of the viewport's width (vw)

        Note: Internet Explorer only supports vw since version 9

      • ViewportHeight

        public static final LengthUnit ViewportHeight
        A percentage of the viewport's height (vh)

        Note: Internet Explorer only supports vh since version 9

      • ViewportMin

        public static final LengthUnit ViewportMin
        A percentage of the viewport's smaller dimension (vmin)

        Note: Internet Explorer only supports vmin since version 9

      • ViewportMax

        public static final LengthUnit ViewportMax
        A percentage of the viewport's larger dimension (vmax)

        Note: Not supported on Internet Explorer

    • Method Detail

      • values

        public static LengthUnit[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (LengthUnit c : LengthUnit.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static LengthUnit valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getValue

        public int getValue()
        Returns the numerical representation of this enum.