Class SwingSizeHandler
- java.lang.Object
-
- net.sf.jguiraffe.gui.platform.swing.layout.SwingSizeHandler
-
- All Implemented Interfaces:
Serializable
,net.sf.jguiraffe.gui.layout.UnitSizeHandler
public class SwingSizeHandler extends Object implements net.sf.jguiraffe.gui.layout.UnitSizeHandler, Serializable
Swing specific implementation of the
SizeHandler
interface.Note: This implementation performs some caching to optimize performance, but it is not synchronized. So it must be ensured that an instance is accessed by a single thread only or that manual synchronization is performed.
- Version:
- $Id: SwingSizeHandler.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SwingSizeHandler()
Creates a new instance ofSwingSizeHandler
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getFontSize(Object component, boolean y)
Calculates the desired font size for the given component.int
getScreenResolution()
Returns the current screen resolution.
-
-
-
Method Detail
-
getFontSize
public double getFontSize(Object component, boolean y)
Calculates the desired font size for the given component. The passed in object is expected to be aComponent
instance.- Specified by:
getFontSize
in interfacenet.sf.jguiraffe.gui.layout.UnitSizeHandler
- Parameters:
component
- the component (must not be null)y
- the orientation flag- Returns:
- the font size
- Throws:
IllegalArgumentException
- if the component is null
-
getScreenResolution
public int getScreenResolution()
Returns the current screen resolution.- Specified by:
getScreenResolution
in interfacenet.sf.jguiraffe.gui.layout.UnitSizeHandler
- Returns:
- the screen resolution
-
-