com.alee.utils
Class SizeUtils

java.lang.Object
  extended by com.alee.utils.SizeUtils

public final class SizeUtils
extends java.lang.Object

This class provides a set of utilities to modify component sizes.

Author:
Mikle Garin

Constructor Summary
SizeUtils()
           
 
Method Summary
static
<C extends java.awt.Component>
int
getMinimumHeight(C component)
          Returns component minimum height.
static
<C extends java.awt.Component>
int
getMinimumWidth(C component)
          Returns component minimum width.
static
<C extends java.awt.Component>
int
getPreferredHeight(C component)
          Returns component preferred height.
static
<C extends java.awt.Component>
java.awt.Dimension
getPreferredSize(C component, java.awt.Dimension actualPreferredSize)
          Returns component preferred size.
static
<C extends java.awt.Component>
int
getPreferredWidth(C component)
          Returns component preferred width.
static
<C extends java.awt.Component>
C
setMinimumHeight(C component, int minimumHeight)
          Sets component minimum height.
static
<C extends java.awt.Component>
C
setMinimumWidth(C component, int minimumWidth)
          Sets component minimum width.
static
<C extends java.awt.Component>
C
setPreferredHeight(C component, int preferredHeight)
          Sets component preferred height.
static
<C extends java.awt.Component>
C
setPreferredWidth(C component, int preferredWidth)
          Sets component preferred width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeUtils

public SizeUtils()
Method Detail

getPreferredWidth

public static <C extends java.awt.Component> int getPreferredWidth(C component)
Returns component preferred width.

Type Parameters:
C - component type
Parameters:
component - component to process
Returns:
component preferred width

setPreferredWidth

public static <C extends java.awt.Component> C setPreferredWidth(C component,
                                                                 int preferredWidth)
Sets component preferred width. Pass -1 to let component choose preferred width on its own.

Type Parameters:
C - component type
Parameters:
component - component to process
preferredWidth - new component preferred width
Returns:
modified component

getPreferredHeight

public static <C extends java.awt.Component> int getPreferredHeight(C component)
Returns component preferred height.

Type Parameters:
C - component type
Parameters:
component - component to process
Returns:
component preferred height

setPreferredHeight

public static <C extends java.awt.Component> C setPreferredHeight(C component,
                                                                  int preferredHeight)
Sets component preferred height. Pass -1 to let component choose preferred height on its own.

Type Parameters:
C - component type
Parameters:
component - component to process
preferredHeight - new component preferred height
Returns:
modified component

getMinimumWidth

public static <C extends java.awt.Component> int getMinimumWidth(C component)
Returns component minimum width.

Type Parameters:
C - component type
Parameters:
component - component to process
Returns:
component minimum width

setMinimumWidth

public static <C extends java.awt.Component> C setMinimumWidth(C component,
                                                               int minimumWidth)
Sets component minimum width. Pass -1 to let component choose minimum width on its own.

Type Parameters:
C - component type
Parameters:
component - component to process
minimumWidth - new component minimum width
Returns:
modified component

getMinimumHeight

public static <C extends java.awt.Component> int getMinimumHeight(C component)
Returns component minimum height.

Type Parameters:
C - component type
Parameters:
component - component to process
Returns:
component minimum height

setMinimumHeight

public static <C extends java.awt.Component> C setMinimumHeight(C component,
                                                                int minimumHeight)
Sets component minimum height. Pass -1 to let component choose minimum height on its own.

Type Parameters:
C - component type
Parameters:
component - component to process
minimumHeight - new component minimum height
Returns:
modified component

getPreferredSize

public static <C extends java.awt.Component> java.awt.Dimension getPreferredSize(C component,
                                                                                 java.awt.Dimension actualPreferredSize)
Returns component preferred size.

Type Parameters:
C - component type
Parameters:
component - component to process
actualPreferredSize - actual component preferred size
Returns:
component preferred size