|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectyu.ac.bg.etf.javaqx.qswing.layouts.formlayout.util.AbstractUnitConverter
An abstract implementation of the UnitConverter
interface that
minimizes the effort required to convert font-dependent sizes to pixels.
NOTE: This code is part of the JGoodies Forms port.
Constructor Summary | |
AbstractUnitConverter()
|
Method Summary | |
protected int |
centimeterAsPixel(double cm,
int dpi)
Converts Centimeters and returns pixels using the specified resolution. |
int |
centimeterAsPixel(double cm,
JQComponent component)
Converts Centimeters and returns pixels using the resolution of the given component's graphics object. |
protected double |
computeAverageCharWidth(FontMetrics metrics,
java.lang.String testString)
Computes and returns the average character width of the specified test string using the given FontMetrics. |
protected int |
dialogUnitXAsPixel(int dluX,
double dialogBaseUnitsX)
Converts horizontal dialog units and returns pixels. |
int |
dialogUnitXAsPixel(int dluX,
JQComponent c)
Converts horizontal dialog units and returns pixels. |
protected int |
dialogUnitYAsPixel(int dluY,
double dialogBaseUnitsY)
Converts vertical dialog units and returns pixels. |
int |
dialogUnitYAsPixel(int dluY,
JQComponent c)
Converts vertical dialog units and returns pixels. |
protected abstract double |
getDialogBaseUnitsX(JQComponent component)
Gets and returns the horizontal dialog base units. |
protected abstract double |
getDialogBaseUnitsY(JQComponent component)
Gets and returns the vertical dialog base units. |
protected int |
getScreenResolution()
Returns the components screen resolution or the default screen resolution if the component is null or has no toolkit assigned yet. |
protected int |
inchAsPixel(double in,
int dpi)
Converts Inches and returns pixels using the specified resolution. |
int |
inchAsPixel(double in,
JQComponent component)
Converts Inches and returns pixels using the specified resolution. |
protected int |
millimeterAsPixel(double mm,
int dpi)
Converts Millimeters and returns pixels using the specified resolution. |
int |
millimeterAsPixel(double mm,
JQComponent component)
Converts Millimeters and returns pixels using the resolution of the given component's graphics object. |
protected int |
pointAsPixel(int pt,
int dpi)
Converts DTP Points and returns pixels using the specified resolution. |
int |
pointAsPixel(int pt,
JQComponent component)
Converts DTP Points and returns pixels using the resolution of the given component's graphics object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractUnitConverter()
Method Detail |
public int inchAsPixel(double in, JQComponent component)
inchAsPixel
in interface UnitConverter
in
- the inchescomponent
- the component that provides the graphics object
public int millimeterAsPixel(double mm, JQComponent component)
millimeterAsPixel
in interface UnitConverter
mm
- the millimeterscomponent
- the component that provides the graphics object
public int centimeterAsPixel(double cm, JQComponent component)
centimeterAsPixel
in interface UnitConverter
cm
- the centimeterscomponent
- the component that provides the graphics object
public int pointAsPixel(int pt, JQComponent component)
pointAsPixel
in interface UnitConverter
pt
- the DTP pointscomponent
- the component that provides the graphics object
public int dialogUnitXAsPixel(int dluX, JQComponent c)
dialogUnitXAsPixel
in interface UnitConverter
dluX
- the horizontal dialog unitsc
- a Component that provides the font and graphics
public int dialogUnitYAsPixel(int dluY, JQComponent c)
dialogUnitYAsPixel
in interface UnitConverter
dluY
- the vertical dialog unitsc
- a Component that provides the font and graphics
protected abstract double getDialogBaseUnitsX(JQComponent component)
component
- a component that provides the font and graphics
protected abstract double getDialogBaseUnitsY(JQComponent component)
component
- a Component that provides the font and graphics
protected final int inchAsPixel(double in, int dpi)
in
- the inchesdpi
- the resolution
protected final int millimeterAsPixel(double mm, int dpi)
mm
- the millimetersdpi
- the resolution
protected final int centimeterAsPixel(double cm, int dpi)
cm
- Centimetersdpi
- the resolution
protected final int pointAsPixel(int pt, int dpi)
pt
- DTP Pointsdpi
- the resolution in dpi
protected int dialogUnitXAsPixel(int dluX, double dialogBaseUnitsX)
dluX
- the horizontal dialog unitsdialogBaseUnitsX
- the horizontal dialog base units
protected int dialogUnitYAsPixel(int dluY, double dialogBaseUnitsY)
dluY
- the vertical dialog unitsdialogBaseUnitsY
- the vertical dialog base units
protected double computeAverageCharWidth(FontMetrics metrics, java.lang.String testString)
metrics
- used to compute the test string's widthtestString
- the string that shall represent an "average" text
protected int getScreenResolution()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |