Class 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 Detail

      • SwingSizeHandler

        public SwingSizeHandler()
        Creates a new instance of SwingSizeHandler.
    • 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 a Component instance.
        Specified by:
        getFontSize in interface net.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 interface net.sf.jguiraffe.gui.layout.UnitSizeHandler
        Returns:
        the screen resolution