Package javafx.css

Class Size

java.lang.Object
javafx.css.Size

public final class Size extends Object
Represents a size specified in a particular unit, such as 14px or 0.2em.
Since:
9
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Size(double value, SizeUnits units)
    Constructs a Size object.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    Return the units.
    double
    Returns the value.
    boolean
    Returns whether or not this Size is an absolute value or a relative value.
    double
    A convenience method for calling pixels(1)
    double
    pixels(double multiplier, Font font)
    Converts this size into pixels.
    double
    pixels(Font font)
    If size is not an absolute size, return the product of font size in pixels and value.

    Methods declared in class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details Link icon

    • Size Link icon

      public Size(double value, SizeUnits units)
      Constructs a Size object.
      Parameters:
      value - value of the size
      units - unit of the size
  • Method Details Link icon

    • getValue Link icon

      public double getValue()
      Returns the value.
      Returns:
      the value
    • getUnits Link icon

      public SizeUnits getUnits()
      Return the units.
      Returns:
      the units
    • isAbsolute Link icon

      public boolean isAbsolute()
      Returns whether or not this Size is an absolute value or a relative value.
      Returns:
      true if it is absolute, otherwise false
    • pixels Link icon

      public double pixels(double multiplier, Font font)
      Converts this size into pixels.
      Parameters:
      multiplier - The multiplier for PERCENTAGE sizes
      font - The font for EM sizes
      Returns:
      the size in pixels
    • pixels Link icon

      public double pixels(Font font)
      If size is not an absolute size, return the product of font size in pixels and value. Otherwise, return the absolute value.
      Parameters:
      font - the font
      Returns:
      the size of pixels
    • pixels Link icon

      public double pixels()
      A convenience method for calling pixels(1)
      Returns:
      the size in pixels