Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.util.swing
Class FitLayout

java.lang.Object
  extended by net.java.sip.communicator.util.swing.FitLayout
All Implemented Interfaces:
LayoutManager
Direct Known Subclasses:
VideoLayout

public class FitLayout
extends Object
implements LayoutManager

Represents a LayoutManager which centers the first Component within its Container and, if the preferred size of the Component is larger than the size of the Container, scales the former within the bounds of the latter while preserving the aspect ratio. FitLayout is appropriate for Containers which display a single image or video Component in its entirety for which preserving the aspect ratio is important.

Author:
Lyubomir Marinov

Constructor Summary
FitLayout()
           
 
Method Summary
 void addLayoutComponent(String name, Component comp)
           
protected  Component getComponent(Container parent)
          Gets the first Component of a specific Container if there is such a Component.
protected  void layoutComponent(Component component, Rectangle bounds, float alignmentX, float alignmentY)
           
 void layoutContainer(Container parent)
           
protected  void layoutContainer(Container parent, float componentAlignmentX)
           
 Dimension minimumLayoutSize(Container parent)
           
 Dimension preferredLayoutSize(Container parent)
           
 void removeLayoutComponent(Component comp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FitLayout

public FitLayout()
Method Detail

addLayoutComponent

public void addLayoutComponent(String name,
                               Component comp)
Specified by:
addLayoutComponent in interface LayoutManager

getComponent

protected Component getComponent(Container parent)
Gets the first Component of a specific Container if there is such a Component.

Parameters:
parent - the Container to retrieve the first Component of
Returns:
the first Component of a specific Container if there is such a Component; otherwise, null

layoutComponent

protected void layoutComponent(Component component,
                               Rectangle bounds,
                               float alignmentX,
                               float alignmentY)

layoutContainer

public void layoutContainer(Container parent)
Specified by:
layoutContainer in interface LayoutManager

layoutContainer

protected void layoutContainer(Container parent,
                               float componentAlignmentX)

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)
Specified by:
minimumLayoutSize in interface LayoutManager

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Specified by:
preferredLayoutSize in interface LayoutManager

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Specified by:
removeLayoutComponent in interface LayoutManager

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.