com.jgoodies.forms.util
Interface UnitConverter
- AbstractUnitConverter, DefaultUnitConverter
public interface UnitConverter
An interface that describes how to convert general sizes to pixel sizes.
For example,
dialog units require a conversion that honors
the font and resolution. The
Sizes
class
delegates all size conversions to an implementation of this interface.
int | centimeterAsPixel(double cm, Component component) - Converts Centimeters and returns pixels using the resolution of the
given component's graphics object.
|
int | dialogUnitXAsPixel(int dluX, Component component) - Converts horizontal dialog units and returns pixels.
|
int | dialogUnitYAsPixel(int dluY, Component component) - Converts vertical dialog units and returns pixels.
|
int | inchAsPixel(double in, Component component) - Converts Inches and returns pixels using the specified resolution.
|
int | millimeterAsPixel(double mm, Component component) - Converts Millimeters and returns pixels using the resolution of the
given component's graphics object.
|
int | pointAsPixel(int pt, Component component) - Converts DTP Points and returns pixels using the resolution of the
given component's graphics object.
|
centimeterAsPixel
public int centimeterAsPixel(double cm,
Component component)
Converts Centimeters and returns pixels using the resolution of the
given component's graphics object.
cm
- Centimeterscomponent
- the component that provides the graphics object
- the given Centimeters as pixels
dialogUnitXAsPixel
public int dialogUnitXAsPixel(int dluX,
Component component)
Converts horizontal dialog units and returns pixels.
Honors the resolution, dialog font size, platform and look&feel.
dluX
- the horizontal dialog unitscomponent
- a component that provides the font and graphics
- the given horizontal dialog units as pixels
dialogUnitYAsPixel
public int dialogUnitYAsPixel(int dluY,
Component component)
Converts vertical dialog units and returns pixels.
Honors the resolution, dialog font size, platform and look&feel.
dluY
- the vertical dialog unitscomponent
- a component that provides the font and graphics
- the given vertical dialog units as pixels
inchAsPixel
public int inchAsPixel(double in,
Component component)
Converts Inches and returns pixels using the specified resolution.
in
- the Inchescomponent
- the component that provides the graphics object
- the given Inches as pixels
millimeterAsPixel
public int millimeterAsPixel(double mm,
Component component)
Converts Millimeters and returns pixels using the resolution of the
given component's graphics object.
mm
- Millimeterscomponent
- the component that provides the graphics object
- the given Millimeters as pixels
pointAsPixel
public int pointAsPixel(int pt,
Component component)
Converts DTP Points and returns pixels using the resolution of the
given component's graphics object.
pt
- DTP Pointscomponent
- the component that provides the graphics object
- the given Points as pixels
Copyright © 2002-2008 JGoodies Karsten Lentzsch. All Rights Reserved.