|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jgoodies.uif.util.Resizer
public final class Resizer
Assists in getting aesthetic aspect ratios for panels and dialogs.
Field Summary | |
---|---|
static Resizer |
DEFAULT
The default Resizer for an aspect ratio of 4:3. |
static Resizer |
FIVE2FOUR
A Resizer for an aspect ratio of 5:4. |
static Resizer |
FOUR2THREE
A Resizer for an aspect ratio of 4:3. |
static Resizer |
ONE2ONE
A Resizer for an aspect ratio of 1:1. |
static Resizer |
REVERSE_SQRT
A Resizer for an aspect ratio of 1:sqrt(2). |
static Resizer |
SQRT
A Resizer for an aspect ratio of sqrt(2):1. |
Constructor Summary | |
---|---|
Resizer(float aspectRatio)
Constructs a Resizer with the specified aspect ratio. |
Method Summary | |
---|---|
Dimension |
from(Dimension original)
Returns a Dimension that has this Resizer's aspect ratio and has been computed by adjusting the given dimension. |
Dimension |
from(Dimension original,
int horizontalMargin,
int verticalMargin)
Returns a Dimension that is based on this Resizer's aspect ratio and has been computed by adjusting the given dimension. |
Dimension |
fromHeight(int height)
Returns a Dimension with the given height and a computed width so that the result has this Resizer's aspect ratio. |
Dimension |
fromWidth(int width)
Returns a Dimension with the given width and a computed height so that the result has this Resizer's aspect ratio. |
void |
resize(JComponent component)
Sets the component's preferred size to a Dimension that has this Resizer's aspect ratio. |
void |
resizeDialogContent(JComponent component)
Sets the component's preferred size to a Dimension that has this Resizer's aspect ratio. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Resizer ONE2ONE
public static final Resizer FIVE2FOUR
public static final Resizer FOUR2THREE
public static final Resizer DEFAULT
public static final Resizer SQRT
public static final Resizer REVERSE_SQRT
Constructor Detail |
---|
public Resizer(float aspectRatio)
aspectRatio
- the aspect ratio used to compute DimensionsMethod Detail |
---|
public Dimension from(Dimension original)
original
- the Dimension to be adjusted to be aesthetic
public Dimension from(Dimension original, int horizontalMargin, int verticalMargin)
The adjustment algorithm favors expanding the width over expanding the height.
original
- the inner DimensionhorizontalMargin
- the sum of the left and right margin to be addedverticalMargin
- the sum of the top and bottom margin to be added
public Dimension fromHeight(int height)
height
- the height used to compute the width
public Dimension fromWidth(int width)
width
- the width used to compute the height
public void resize(JComponent component)
component
- the component to be resizedfrom(Dimension)
public void resizeDialogContent(JComponent component)
component
- the component to be resizedfrom(Dimension, int, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |