public final class Unit
extends java.lang.Object
Specifies the size value in different units (Pixel, Inches, etc.).
This sample shows how to create and save a BarCode image.BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.CODE_128, "7890"); generator.getBorder().setVisible(true); generator.getBorder().setColor(Color.CYAN); generator.getBorder().setDashStyle(BorderDashStyle.DashDot); Unit widthUnit = generator.getBorder().getWidth(); widthUnit.setMillimeters(2); float width = generator.getBorder().getWidth().getMillimeters();
Constructor and Description |
---|
Unit(float value,
GraphicsUnit graphicsUnit)
Initializes a new instance of the Unit
It's using only in autogenerated code for UserControl, please don't use it.
|
Unit(float value,
int graphicsUnit)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Determines whether this instance and a specified object,
which must also be a
Unit object, have the same value. |
float |
getDocument()
Gets or sets size value in document units.
|
GraphicsUnit |
getGraphicsUnit() |
float |
getInches()
Gets or sets size value in inches.
|
float |
getMillimeters()
Gets or sets size value in millimeters.
|
float |
getPixels()
Gets or sets size value in pixels.
|
float |
getPoint()
Gets or sets size value in point.
|
int |
hashCode()
Returns the hash code for this object.
|
void |
setDocument(float value)
Gets or sets size value in document units.
|
void |
setInches(float value)
Gets or sets size value in inches.
|
void |
setMillimeters(float value)
Gets or sets size value in millimeters.
|
void |
setPixels(float value)
Gets or sets size value in pixels.
|
void |
setPoint(float value)
Gets or sets size value in point.
|
java.lang.String |
toString()
Returns a human-readable string representation of this
Unit . |
@Deprecated public Unit(float value, int graphicsUnit)
value
- Size value the new Unit in the units specified by the graphicsUnit parameter.graphicsUnit
- The GraphicsUnit of the new Unit object.public Unit(float value, GraphicsUnit graphicsUnit)
value
- Size value the new Unit in the units specified by the graphicsUnit parameter.graphicsUnit
- The GraphicsUnit of the new Unit object.public float getPixels()
Gets or sets size value in pixels.
public void setPixels(float value)
Gets or sets size value in pixels.
public float getInches()
Gets or sets size value in inches.
public void setInches(float value)
Gets or sets size value in inches.
public float getMillimeters()
Gets or sets size value in millimeters.
public void setMillimeters(float value)
Gets or sets size value in millimeters.
public float getPoint()
Gets or sets size value in point.
public void setPoint(float value)
Gets or sets size value in point.
public float getDocument()
Gets or sets size value in document units.
public void setDocument(float value)
Gets or sets size value in document units.
public java.lang.String toString()
Returns a human-readable string representation of this Unit
.
toString
in class java.lang.Object
Unit
.public boolean equals(java.lang.Object obj)
Determines whether this instance and a specified object,
which must also be a Unit
object, have the same value.
equals
in class java.lang.Object
obj
- The Unit
to compare to this instance.Unit
and its value is the same as this instance;
otherwise, false. If obj is null, the method returns false.public int hashCode()
Returns the hash code for this object.
hashCode
in class java.lang.Object
public GraphicsUnit getGraphicsUnit()