Unit

Inheritance: java.lang.Object

public final class Unit

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);
 	  generator.getParameters().getBarcode().getBarHeight().setMillimeters(10);
    generator.save("test.png");

Constructors

ConstructorDescription
Unit(float value, GraphicsUnit graphicsUnit)Initializes a new instance of the Unit class.
Unit(Unit source)

Methods

MethodDescription
equals(Object obj)Determines whether this instance and a specified object, which must also be a Unit object, have the same value.
getClass()
getDocument()Gets size value in document units.
getInches()Gets size value in inches.
getMillimeters()Gets size value in millimeters.
getPixels()Gets size value in pixels.
getPoint()Gets size value in point.
getPx()
getResolution()
hashCode()Returns the hash code for this object.
notify()
notifyAll()
setDocument(float value)Sets size value in document units.
setInches(float value)Sets size value in inches.
setMillimeters(float value)Sets size value in millimeters.
setPixels(float value)Sets size value in pixels.
setPoint(float value)Sets size value in point.
toString()Returns a human-readable string representation of this Unit .
updateResolution(float dpi)
wait()
wait(long arg0)
wait(long arg0, int arg1)

Unit(float value, GraphicsUnit graphicsUnit)

public Unit(float value, GraphicsUnit graphicsUnit)

Initializes a new instance of the Unit class. It’s using only in autogenerated code for UserControl, please don’t use it.

Parameters:

ParameterTypeDescription
valuefloatSize value the new Unit in the units specified by the graphicsUnit parameter.
graphicsUnitGraphicsUnitThe GraphicsUnit of the new Unit object.

Unit(Unit source)

public Unit(Unit source)

Parameters:

ParameterTypeDescription
sourceUnit

equals(Object obj)

public boolean equals(Object obj)

Determines whether this instance and a specified object, which must also be a Unit object, have the same value.

Parameters:

ParameterTypeDescription
objjava.lang.ObjectThe Unit to compare to this instance.

Returns: boolean - true if obj is a Unit and its value is the same as this instance; otherwise, false. If obj is null, the method returns false.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getDocument()

public float getDocument()

Gets size value in document units.

Returns: float

getInches()

public float getInches()

Gets size value in inches.

Returns: float

getMillimeters()

public float getMillimeters()

Gets size value in millimeters.

Returns: float

getPixels()

public float getPixels()

Gets size value in pixels.

Returns: float

getPoint()

public float getPoint()

Gets size value in point.

Returns: float

getPx()

public int getPx()

Returns: int

getResolution()

public float getResolution()

Returns: float

hashCode()

public int hashCode()

Returns the hash code for this object.

Returns: int - A 32-bit signed integer hash code.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setDocument(float value)

public void setDocument(float value)

Sets size value in document units.

Parameters:

ParameterTypeDescription
valuefloat

setInches(float value)

public void setInches(float value)

Sets size value in inches.

Parameters:

ParameterTypeDescription
valuefloat

setMillimeters(float value)

public void setMillimeters(float value)

Sets size value in millimeters.

Parameters:

ParameterTypeDescription
valuefloat

setPixels(float value)

public void setPixels(float value)

Sets size value in pixels.

Parameters:

ParameterTypeDescription
valuefloat

setPoint(float value)

public void setPoint(float value)

Sets size value in point.

Parameters:

ParameterTypeDescription
valuefloat

toString()

public String toString()

Returns a human-readable string representation of this Unit .

Returns: java.lang.String - A string that represents this Unit .

updateResolution(float dpi)

public void updateResolution(float dpi)

Parameters:

ParameterTypeDescription
dpifloat

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int