|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ehsbe.commons.gui.ButtonAreaLayout
public class ButtonAreaLayout
ButtonAreaLayout
behaves in a similar manner to
FlowLayout
. It lays out all components per default from left to
right. If syncAllWidths
is true
, the width of each component
will be set to the largest preferred size width. Per default, all buttons
will have a minimum width of 80 pixels.
If syncAllHeights
is true, the height of each component
will be set to the largest preferred size height. If it is false, all
components will have their preferred height and are vertically centered in
their container.
Per default, all buttons will have a minimum height of 20 pixels.
If the preferred size of a component is less than the minimum size, the minimum size will be used instead.
Constructor Summary | |
---|---|
ButtonAreaLayout()
Create a new standard ButtonLayout. |
|
ButtonAreaLayout(boolean syncAllWidths,
boolean syncAllHeights,
int padding,
int orientation,
boolean reverseButtons,
Dimension minSize)
Create a new ButtonLayouter. |
|
ButtonAreaLayout(boolean syncAllSizes,
int padding)
Create a new ButtonLayout. |
|
ButtonAreaLayout(boolean syncAllSizes,
int padding,
int orientation)
Create a new ButtonLayouter. |
|
ButtonAreaLayout(boolean syncAllSizes,
int padding,
int orientation,
boolean reverseButtons,
Dimension minSize)
Create a new ButtonLayouter. |
Method Summary | |
---|---|
void |
addLayoutComponent(Component comp,
Object constraints)
|
void |
addLayoutComponent(String name,
Component comp)
|
float |
getLayoutAlignmentX(Container container)
|
float |
getLayoutAlignmentY(Container container)
|
Dimension |
getMinButtonSize()
Get the minimum size, a button should have. |
int |
getOrientation(Container container)
Get the orientation used for button layout wrt. the given container. |
boolean |
getPackButtons()
Check, whether buttons get packed on centered orientation, so that the distance between the buttons is exactly the value of padding . |
int |
getPadding()
Get the padding distance between buttons. |
boolean |
getReverse()
Check, whether buttons are layed out in reverse order wrt. to their index in the container's component list |
boolean |
getSyncAllHeights()
Check, whether all buttons will have the same height. |
boolean |
getSyncAllWidths()
Check, whether all buttons will have the same width. |
void |
invalidateLayout(Container target)
|
void |
layoutContainer(Container container)
|
Dimension |
maximumLayoutSize(Container container)
|
Dimension |
minimumLayoutSize(Container container)
|
Dimension |
preferredLayoutSize(Container container)
|
void |
removeLayoutComponent(Component comp)
|
void |
setMinButtonSize(Dimension minButtonSize)
Set the minimum size, a button should have. |
void |
setOrientation(int orientation)
Set the orientation to use for button layout wrt. a left-to-right oriented container. |
void |
setPackButtons(boolean packButtons)
Set, whether buttons should be packed, i.e. distance between them is the value of padding , or whether the distance between the
buttons is the left space in the container equally distributed to all
button distances. |
void |
setPadding(int newPadding)
Set the padding distance between buttons in pixels |
void |
setReverse(boolean newValue)
Set, whether to layout the buttons in reverse order wrt. to their index in the container's component list Per default, this property is set to false . |
void |
setSyncAllHeights(boolean newValue)
Set, whether to make all buttons the same height. |
void |
setSyncAllWidths(boolean newValue)
Set, whether to make all buttons the same witdth. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ButtonAreaLayout()
UIManager properties used:
OptionPane.sameSizeButtons
,
OptionPane.buttonPadding
,
OptionPane.buttonOrientation
public ButtonAreaLayout(boolean syncAllSizes, int padding)
UIManager properties used:
OptionPane.buttonOrientation
syncAllSizes
- If true
, make the size of all buttons equal to
the width of the widest button and the height to the height of
the button with the biggest height.padding
- padding to use between the buttons.public ButtonAreaLayout(boolean syncAllSizes, int padding, int orientation)
syncAllSizes
- If true
, make the size of all buttons equal to
the width of the widest button and the height to the height of
the button with the biggest height.padding
- padding to use between the buttons.orientation
- SwingConstants.LEFT
|| SwingConstants.CENTER
||
SwingConstants.RIGHT
public ButtonAreaLayout(boolean syncAllSizes, int padding, int orientation, boolean reverseButtons, Dimension minSize)
syncAllSizes
- If true
, make the size of all buttons equal to
the width of the widest button and the height to the height of
the button with the biggest height.padding
- padding to use between the buttons.orientation
- SwingConstants.LEFT
|| SwingConstants.CENTER
||
SwingConstants.RIGHT
reverseButtons
- if true
, layout the buttons in reverse order
wrt. to their index in the container's component listminSize
- the minimum size of the buttonspublic ButtonAreaLayout(boolean syncAllWidths, boolean syncAllHeights, int padding, int orientation, boolean reverseButtons, Dimension minSize)
syncAllWidths
- If true
, make the width of all buttons equal to
the width of the widest button.syncAllHeights
- If true
, make the height of all buttons equal to
the height of the button with the biggest height.padding
- padding to use between the buttons.orientation
- SwingConstants.LEFT
|| SwingConstants.CENTER
||
SwingConstants.RIGHT
reverseButtons
- if true
, layout the buttons in reverse order
wrt. to their index in the container's component listminSize
- the minimum size of the buttonsMethod Detail |
---|
public void setReverse(boolean newValue)
Per default, this property is set to false
.
newValue
- if true
, layout in reverse orderpublic boolean getReverse()
true
, layout in reverse orderpublic void setSyncAllWidths(boolean newValue)
newValue
- if true
, equalize the width of all buttonspublic boolean getSyncAllWidths()
true
if all buttons are equalized wrt. their widthpublic void setSyncAllHeights(boolean newValue)
newValue
- if true
, equalize the height of all buttonspublic boolean getSyncAllHeights()
true
if all buttons are equalized wrt. their heightpublic void setPadding(int newPadding)
newPadding
- the new padding distancepublic int getPadding()
public void addLayoutComponent(Component comp, Object constraints)
addLayoutComponent
in interface LayoutManager2
public void addLayoutComponent(String name, Component comp)
addLayoutComponent
in interface LayoutManager
public void removeLayoutComponent(Component comp)
removeLayoutComponent
in interface LayoutManager
public void invalidateLayout(Container target)
invalidateLayout
in interface LayoutManager2
public Dimension maximumLayoutSize(Container container)
maximumLayoutSize
in interface LayoutManager2
public Dimension preferredLayoutSize(Container container)
preferredLayoutSize
in interface LayoutManager
public Dimension minimumLayoutSize(Container container)
minimumLayoutSize
in interface LayoutManager
public void setOrientation(int orientation)
orientation
- SwingConstants.LEFT
|| SwingConstants.CENTER
||
SwingConstants.RIGHT
public int getOrientation(Container container)
container
- container, whoms orientation should be taken into
account. Might be null
- in this case a left-to-right
oriented container is assumed. The parameter is ignored, if
the current orientation strategy of the layout manager is set to
SwingConstants#CENTER
.
SwingConstants.LEFT
|| SwingConstants.CENTER
||
SwingConstants.RIGHT
public void layoutContainer(Container container)
layoutContainer
in interface LayoutManager
public float getLayoutAlignmentX(Container container)
getLayoutAlignmentX
in interface LayoutManager2
public float getLayoutAlignmentY(Container container)
getLayoutAlignmentY
in interface LayoutManager2
public boolean getPackButtons()
padding
.
E.g. packed:
+-------------------------------+ | Button1 Button2 | +-------------------------------+unpacked (padding is ignored):
+-------------------------------+ |Button1 Button2| +-------------------------------+
true
, if the buttons are packed together.getPadding()
,
setPadding(int)
public void setPackButtons(boolean packButtons)
padding
, or whether the distance between the
buttons is the left space in the container equally distributed to all
button distances.
Per default, all buttons are packed.
packButtons
- if true
, pack buttons.public Dimension getMinButtonSize()
null
sizepublic void setMinButtonSize(Dimension minButtonSize)
minButtonSize
- if null
, the default of 80 for width
and 20 for height will be used.
|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |