public final class DefaultUnitConverter extends AbstractUnitConverter
UnitConverter interface
It converts horizontal and vertical dialog base units to pixels.defaultDialogFont and averageCharacterWidthTestString See also Microsoft's suggestion for a custom computatio custom computation More information how to use dialog units in screen design can be foun in Microsoft' Desig Specifications and Guidelines.
CONFIG level.
UnitConverter,
Size,
Sizes,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
BALANCED_AVERAGE_CHARACTER_TEST_STRING |
static String |
MODERN_AVERAGE_CHARACTER_TEST_STRING |
static String |
OLD_AVERAGE_CHARACTER_TEST_STRING |
static String |
PROPERTY_AVERAGE_CHARACTER_WIDTH_TEST_STRING |
static String |
PROPERTY_DEFAULT_DIALOG_FONT |
| Modifier and Type | Method and Description |
|---|---|
String |
getAverageCharacterWidthTestString()
Returns the string used to compute the average character width.
|
Font |
getDefaultDialogFont()
Returns the dialog font that is used to compute the dialog base units.
|
protected double |
getDialogBaseUnitsX(Component component)
Returns the cached or computed horizontal dialog base units.
|
protected double |
getDialogBaseUnitsY(Component component)
Returns the cached or computed vertical dialog base unit
for the given component.
|
static DefaultUnitConverter |
getInstance()
Lazily instantiates and returns the sole instance.
|
void |
setAverageCharacterWidthTestString(String newTestString)
Sets a string that will be used to compute the average character width.
|
void |
setDefaultDialogFont(Font newFont)
Sets a dialog font that will be used to compute the dialog base units.
|
centimeterAsPixel, centimeterAsPixel, computeAverageCharWidth, dialogUnitXAsPixel, dialogUnitXAsPixel, dialogUnitYAsPixel, dialogUnitYAsPixel, getDefaultScreenResolution, getScreenResolution, inchAsPixel, inchAsPixel, millimeterAsPixel, millimeterAsPixel, pointAsPixel, pointAsPixeladdPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPropertyChangeSupport, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListenerpublic static final String PROPERTY_AVERAGE_CHARACTER_WIDTH_TEST_STRING
public static final String PROPERTY_DEFAULT_DIALOG_FONT
public static final String OLD_AVERAGE_CHARACTER_TEST_STRING
public static final String MODERN_AVERAGE_CHARACTER_TEST_STRING
public static final String BALANCED_AVERAGE_CHARACTER_TEST_STRING
public static DefaultUnitConverter getInstance()
public String getAverageCharacterWidthTestString()
BALANCED_AVERAGE_CHARACTER_TEST_STRING.public void setAverageCharacterWidthTestString(String newTestString)
BALANCED_AVERAGE_CHARACTER_TEST_STRING. You can provid
other test strings, for example
newTestString - the test string to be usedNullPointerException - if newTestString is nullIllegalArgumentException - if newTestString is empty or whitespacepublic Font getDefaultDialogFont()
setDefaultDialogFont(Font), this font will be returned
Otherwise a cached fallback will be lazily created.public void setDefaultDialogFont(Font newFont)
newFont - the default dialog font to be setprotected double getDialogBaseUnitsX(Component component)
getDialogBaseUnitsX in class AbstractUnitConvertercomponent - a Component that provides the font and graphicsprotected double getDialogBaseUnitsY(Component component)
getDialogBaseUnitsY in class AbstractUnitConvertercomponent - a Component that provides the font and graphicsCopyright © 2002-2014 JGoodies Software GmbH. All Rights Reserved.