| java.lang.Object com.jgoodies.forms.util.AbstractUnitConverter com.jgoodies.forms.util.DefaultUnitConverter
DefaultUnitConverter | final public class DefaultUnitConverter extends AbstractUnitConverter (Code) | | This is the default implementation of the
UnitConverter interface. It
converts horizontal and vertical dialog base units to pixels.
The horizontal base unit is equal to the average width, in pixels, of the
characters in the system font; the vertical base unit is equal to the height,
in pixels, of the font. Each horizontal base unit is equal to 4 horizontal
dialog units; each vertical base unit is equal to 8 vertical dialog units.
The DefaultUnitConverter computes dialog base units using a default font and
a test string for the average character width. You can configure the font and
the test string via the bound Bean properties defaultDialogFont
and averageCharacterWidthTestString.
version: $Revision: 1.2 $ author: Karsten Lentzsch See Also: UnitConverter See Also: com.jgoodies.forms.layout.Size See Also: com.jgoodies.forms.layout.Sizes |
getAverageCharacterWidthTestString | public String getAverageCharacterWidthTestString()(Code) | | Returns the string used to compute the average character width. By
default it is initialized to "X".
the test string used to compute the average character width |
getDefaultDialogFont | public Font getDefaultDialogFont()(Code) | | Lazily creates and returns the dialog font used to compute the dialog
base units.
the font used to compute the dialog base units |
getDialogBaseUnitsX | protected double getDialogBaseUnitsX(Component component)(Code) | | Returns the cached or computed horizontal dialog base units.
Parameters: component - a Component that provides the font and graphics the horizontal dialog base units |
getDialogBaseUnitsY | protected double getDialogBaseUnitsY(Component component)(Code) | | Returns the cached or computed vertical dialog base units for the given
component.
Parameters: component - a Component that provides the font and graphics the vertical dialog base units |
getInstance | public static DefaultUnitConverter getInstance()(Code) | | Lazily instantiates and returns the sole instance.
the lazily instantiated sole instance |
setAverageCharacterWidthTestString | public void setAverageCharacterWidthTestString(String newTestString)(Code) | | Sets a string that will be used to compute the average character width.
By default it is initialized to "X". You can provide other test
strings, for example:
- "Xximeee"
- "ABCEDEFHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
Parameters: newTestString - the test string to be used throws: IllegalArgumentException - if the test string is empty throws: NullPointerException - if the test string is null |
setDefaultDialogFont | public void setDefaultDialogFont(Font newFont)(Code) | | Sets a dialog font that will be used to compute the dialog base units.
Parameters: newFont - the default dialog font to be set |
Methods inherited from com.jgoodies.forms.util.AbstractUnitConverter | public int centimeterAsPixel(double cm, Component component)(Code)(Java Doc) final protected int centimeterAsPixel(double cm, int dpi)(Code)(Java Doc) protected double computeAverageCharWidth(FontMetrics metrics, String testString)(Code)(Java Doc) public int dialogUnitXAsPixel(int dluX, Component c)(Code)(Java Doc) protected int dialogUnitXAsPixel(int dluX, double dialogBaseUnitsX)(Code)(Java Doc) public int dialogUnitYAsPixel(int dluY, Component c)(Code)(Java Doc) protected int dialogUnitYAsPixel(int dluY, double dialogBaseUnitsY)(Code)(Java Doc) protected int getDefaultScreenResolution()(Code)(Java Doc) abstract protected double getDialogBaseUnitsX(Component component)(Code)(Java Doc) abstract protected double getDialogBaseUnitsY(Component component)(Code)(Java Doc) protected int getScreenResolution(Component c)(Code)(Java Doc) public int inchAsPixel(double in, Component component)(Code)(Java Doc) final protected int inchAsPixel(double in, int dpi)(Code)(Java Doc) public int millimeterAsPixel(double mm, Component component)(Code)(Java Doc) final protected int millimeterAsPixel(double mm, int dpi)(Code)(Java Doc) public int pointAsPixel(int pt, Component component)(Code)(Java Doc) final protected int pointAsPixel(int pt, int dpi)(Code)(Java Doc)
|
|
|