yu.ac.bg.etf.javaqx.qswing.layouts.formlayout.util
Interface UnitConverter

All Known Implementing Classes:
AbstractUnitConverter

public interface UnitConverter

An interface that describes how to convert general sizes to pixel sizes. For example, dialog units require a conversion that honors the font and resolution. The Sizes class delegates all size conversions to an implementation of this interface.

NOTE: This code is part of the JGoodies Forms port.

Version:
$Revision: 1.2 $, 0.2.0
Author:
Karsten Lentzsch, Slobodan Vrkacevic (slobodan.vrkacevic@gmail.com)

Method Summary
 int centimeterAsPixel(double cm, JQComponent component)
          Converts Centimeters and returns pixels using the resolution of the given component's graphics object.
 int dialogUnitXAsPixel(int dluX, JQComponent component)
          Converts horizontal dialog units and returns pixels.
 int dialogUnitYAsPixel(int dluY, JQComponent component)
          Converts vertical dialog units and returns pixels.
 int inchAsPixel(double in, JQComponent component)
          Converts Inches 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.
 int pointAsPixel(int pt, JQComponent component)
          Converts DTP Points and returns pixels using the resolution of the given component's graphics object.
 

Method Detail

inchAsPixel

public int inchAsPixel(double in,
                       JQComponent component)
Converts Inches and returns pixels using the specified resolution.

Parameters:
in - the Inches
component - the component that provides the graphics object
Returns:
the given Inches as pixels

millimeterAsPixel

public int millimeterAsPixel(double mm,
                             JQComponent component)
Converts Millimeters and returns pixels using the resolution of the given component's graphics object.

Parameters:
mm - Millimeters
component - the component that provides the graphics object
Returns:
the given Millimeters as pixels

centimeterAsPixel

public int centimeterAsPixel(double cm,
                             JQComponent component)
Converts Centimeters and returns pixels using the resolution of the given component's graphics object.

Parameters:
cm - Centimeters
component - the component that provides the graphics object
Returns:
the given Centimeters as pixels

pointAsPixel

public int pointAsPixel(int pt,
                        JQComponent component)
Converts DTP Points and returns pixels using the resolution of the given component's graphics object.

Parameters:
pt - DTP Points
component - the component that provides the graphics object
Returns:
the given Points as pixels

dialogUnitXAsPixel

public int dialogUnitXAsPixel(int dluX,
                              JQComponent component)
Converts horizontal dialog units and returns pixels. Honors the resolution, dialog font size, platform and style.

Parameters:
dluX - the horizontal dialog units
component - a component that provides the font and graphics
Returns:
the given horizontal dialog units as pixels

dialogUnitYAsPixel

public int dialogUnitYAsPixel(int dluY,
                              JQComponent component)
Converts vertical dialog units and returns pixels. Honors the resolution, dialog font size, platform and style.

Parameters:
dluY - the vertical dialog units
component - a component that provides the font and graphics
Returns:
the given vertical dialog units as pixels


Copyright © 2007 ETF and contributors. All Rights Reserved.