centimeterAsPixel
public int centimeterAsPixel(double cm,
Component component)
Converts Centimeters and returns pixels using the resolution of the
given component's graphics object.
- centimeterAsPixel in interface UnitConverter
cm
- Centimeterscomponent
- the component that provides the graphics object
- the given Centimeters as pixels
centimeterAsPixel
protected final int centimeterAsPixel(double cm,
int dpi)
Converts Centimeters and returns pixels using the specified resolution.
cm
- Centimetersdpi
- the resolution
- the given Centimeters as pixels
computeAverageCharWidth
protected double computeAverageCharWidth(FontMetrics metrics,
String testString)
Computes and returns the average character width
of the specified test string using the given FontMetrics.
The test string shall represent an "average" text.
metrics
- used to compute the test string's widthtestString
- the string that shall represent an "average" text
- the test string's average character width.
dialogUnitXAsPixel
public int dialogUnitXAsPixel(int dluX,
Component c)
Converts horizontal dialog units and returns pixels.
Honors the resolution, dialog font size, platform, and l&f.
- dialogUnitXAsPixel in interface UnitConverter
dluX
- the horizontal dialog unitsc
- a Component that provides the font and graphics
- the given horizontal dialog units as pixels
dialogUnitXAsPixel
protected int dialogUnitXAsPixel(int dluX,
double dialogBaseUnitsX)
Converts horizontal dialog units and returns pixels.
dluX
- the horizontal dialog unitsdialogBaseUnitsX
- the horizontal dialog base units
- the given dialog base units as pixels
dialogUnitYAsPixel
public int dialogUnitYAsPixel(int dluY,
Component c)
Converts vertical dialog units and returns pixels.
Honors the resolution, dialog font size, platform, and l&f.
- dialogUnitYAsPixel in interface UnitConverter
dluY
- the vertical dialog unitsc
- a Component that provides the font and graphics
- the given vertical dialog units as pixels
dialogUnitYAsPixel
protected int dialogUnitYAsPixel(int dluY,
double dialogBaseUnitsY)
Converts vertical dialog units and returns pixels.
dluY
- the vertical dialog unitsdialogBaseUnitsY
- the vertical dialog base units
- the given dialog base units as pixels
getDefaultScreenResolution
protected int getDefaultScreenResolution()
Computes and returns the default resolution.
- the default screen resolution
getDialogBaseUnitsX
protected abstract double getDialogBaseUnitsX(Component component)
Gets and returns the horizontal dialog base units.
Implementations are encouraged to cache previously computed
dialog base units.
component
- a Component that provides the font and graphics
- the horizontal dialog base units
getDialogBaseUnitsY
protected abstract double getDialogBaseUnitsY(Component component)
Gets and returns the vertical dialog base units.
Implementations are encouraged to cache previously computed
dialog base units.
component
- a Component that provides the font and graphics
- the vertical dialog base units
getScreenResolution
protected int getScreenResolution(Component c)
Returns the components screen resolution or the default screen
resolution if the component is null or has no toolkit assigned yet.
c
- the component to ask for a toolkit
- the component's screen resolution
inchAsPixel
public int inchAsPixel(double in,
Component component)
Converts Inches and returns pixels using the specified resolution.
- inchAsPixel in interface UnitConverter
in
- the Inchescomponent
- the component that provides the graphics object
- the given Inches as pixels
inchAsPixel
protected final int inchAsPixel(double in,
int dpi)
Converts Inches and returns pixels using the specified resolution.
in
- the Inchesdpi
- the resolution
- 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.
- millimeterAsPixel in interface UnitConverter
mm
- Millimeterscomponent
- the component that provides the graphics object
- the given Millimeters as pixels
millimeterAsPixel
protected final int millimeterAsPixel(double mm,
int dpi)
Converts Millimeters and returns pixels using the specified resolution.
mm
- Millimetersdpi
- the resolution
- 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.
- pointAsPixel in interface UnitConverter
pt
- DTP Pointscomponent
- the component that provides the graphics object
- the given Points as pixels
pointAsPixel
protected final int pointAsPixel(int pt,
int dpi)
Converts DTP Points and returns pixels using the specified resolution.
pt
- DTP Pointsdpi
- the resolution in dpi
- the given Points as pixels