Class Cm


public class Cm extends Units
CSS cm (centimeter) unit value.

The cm unit is an absolute-length unit equal to one centimeter. In CSS, 1cm equals 96px/2.54 (approximately 37.8px). Centimeters are primarily useful for print stylesheets where physical measurements are important.

Usage:


 Units size = new Cm(5);
 element.setWidth(new Cm(10));
 element.setMargin(new Cm(2.5f));
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Cm

      public Cm(float value)
      Constructs a Cm unit with the specified value.
      Parameters:
      value - the centimeter value
  • Method Details

    • sizeToString

      public String sizeToString()
      Returns the CSS string representation of this cm value.
      Specified by:
      sizeToString in class Units
      Returns:
      the CSS value string (e.g., "5cm")