|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jgoodies.common.bean.Bean
com.jgoodies.forms.util.AbstractUnitConverter
public abstract class AbstractUnitConverter
An abstract implementation of the UnitConverter interface that
minimizes the effort required to convert font-dependent sizes to pixels.
DefaultUnitConverter,
Size,
Sizes,
Serialized Form| Field Summary |
|---|
| Fields inherited from class com.jgoodies.common.bean.Bean |
|---|
changeSupport |
| Constructor Summary | |
|---|---|
AbstractUnitConverter()
|
|
| Method Summary | |
|---|---|
int |
centimeterAsPixel(double cm,
Component component)
Converts Centimeters and returns pixels using the resolution of the given component's graphics object. |
protected static int |
centimeterAsPixel(double cm,
int dpi)
Converts Centimeters and returns pixels using the specified resolution. |
protected double |
computeAverageCharWidth(FontMetrics metrics,
String testString)
Computes and returns the average character width of the specified test string using the given FontMetrics. |
int |
dialogUnitXAsPixel(int dluX,
Component c)
Converts horizontal dialog units and returns pixels. |
protected int |
dialogUnitXAsPixel(int dluX,
double dialogBaseUnitsX)
Converts horizontal dialog units and returns pixels. |
int |
dialogUnitYAsPixel(int dluY,
Component c)
Converts vertical dialog units and returns pixels. |
protected int |
dialogUnitYAsPixel(int dluY,
double dialogBaseUnitsY)
Converts vertical dialog units and returns pixels. |
protected int |
getDefaultScreenResolution()
Computes and returns the default resolution. |
protected abstract double |
getDialogBaseUnitsX(Component component)
Gets and returns the horizontal dialog base units. |
protected abstract double |
getDialogBaseUnitsY(Component component)
Gets and returns the vertical dialog base units. |
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. |
int |
inchAsPixel(double in,
Component component)
Converts Inches and returns pixels using the specified resolution. |
protected static int |
inchAsPixel(double in,
int dpi)
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. |
protected static int |
millimeterAsPixel(double mm,
int dpi)
Converts Millimeters and returns pixels using the specified resolution. |
int |
pointAsPixel(int pt,
Component component)
Converts DTP Points and returns pixels using the resolution of the given component's graphics object. |
protected static int |
pointAsPixel(int pt,
int dpi)
Converts DTP Points and returns pixels using the specified resolution. |
| Methods inherited from class com.jgoodies.common.bean.Bean |
|---|
addPropertyChangeListener, 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, removeVetoableChangeListener |
| 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,
Component component)
inchAsPixel in interface UnitConverterin - the Inchescomponent - the component that provides the graphics object
public int millimeterAsPixel(double mm,
Component component)
millimeterAsPixel in interface UnitConvertermm - Millimeterscomponent - the component that provides the graphics object
public int centimeterAsPixel(double cm,
Component component)
centimeterAsPixel in interface UnitConvertercm - Centimeterscomponent - the component that provides the graphics object
public int pointAsPixel(int pt,
Component component)
pointAsPixel in interface UnitConverterpt - DTP Pointscomponent - the component that provides the graphics object
public int dialogUnitXAsPixel(int dluX,
Component c)
dialogUnitXAsPixel in interface UnitConverterdluX - the horizontal dialog unitsc - a Component that provides the font and graphics
public int dialogUnitYAsPixel(int dluY,
Component c)
dialogUnitYAsPixel in interface UnitConverterdluY - the vertical dialog unitsc - a Component that provides the font and graphics
protected abstract double getDialogBaseUnitsX(Component component)
component - a Component that provides the font and graphics
protected abstract double getDialogBaseUnitsY(Component component)
component - a Component that provides the font and graphics
protected static final int inchAsPixel(double in,
int dpi)
in - the Inchesdpi - the resolution
protected static final int millimeterAsPixel(double mm,
int dpi)
mm - Millimetersdpi - the resolution
protected static final int centimeterAsPixel(double cm,
int dpi)
cm - Centimetersdpi - the resolution
protected static 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,
String testString)
metrics - used to compute the test string's widthtestString - the string that shall represent an "average" text
protected int getScreenResolution(Component c)
c - the component to ask for a toolkit
protected int getDefaultScreenResolution()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||