Package com.jgoodies.looks.common
Class ExtButtonAreaLayout
java.lang.Object
javax.swing.plaf.basic.BasicOptionPaneUI.ButtonAreaLayout
com.jgoodies.looks.common.ExtButtonAreaLayout
- All Implemented Interfaces:
LayoutManager
Unlike its superclass, this layout uses a minimum button width
that complies with Mac and Windows UI style guides.
- Version:
- $Revision: 1.13 $
-
Field Summary
Fields inherited from class javax.swing.plaf.basic.BasicOptionPaneUI.ButtonAreaLayout
centersChildren, padding, syncAllWidths -
Constructor Summary
ConstructorsConstructorDescriptionExtButtonAreaLayout(boolean syncAllWidths, int padding) Constructs anExtButtonAreaLayout. -
Method Summary
Modifier and TypeMethodDescriptionprivate static intComputes and answers the minimum button width.voidlayoutContainer(Container container) Methods inherited from class javax.swing.plaf.basic.BasicOptionPaneUI.ButtonAreaLayout
addLayoutComponent, getCentersChildren, getPadding, getSyncAllWidths, preferredLayoutSize, removeLayoutComponent, setCentersChildren, setPadding, setSyncAllWidths
-
Constructor Details
-
ExtButtonAreaLayout
public ExtButtonAreaLayout(boolean syncAllWidths, int padding) Constructs anExtButtonAreaLayout.- Parameters:
syncAllWidths- true indicates that all buttons get the same sizepadding- the padding between buttons
-
-
Method Details
-
layoutContainer
- Specified by:
layoutContainerin interfaceLayoutManager- Overrides:
layoutContainerin classBasicOptionPaneUI.ButtonAreaLayout
-
minimumLayoutSize
- Specified by:
minimumLayoutSizein interfaceLayoutManager- Overrides:
minimumLayoutSizein classBasicOptionPaneUI.ButtonAreaLayout
-
getMinimumButtonWidth
private static int getMinimumButtonWidth()Computes and answers the minimum button width. The MS UX guide recommends a minimum width of 50 Dialog units (DLU).This current implementation assumes an 8pt Tahoma and honors resolutions of 96dpi and 120dpi. This leads to a good approximation of the 50dlu for the vast majority of today's target systems. And it sure is an improvement over the superclass' value of 0.
A better implementation would use a conversion from dlu to pixel for the given buttons (that may have different font render contexts if located in different graphics environments in a multi-screen context). The JGoodies Forms provides such a converter and offers a better button layout by means of the
ButtonBarBuilder2class.- Returns:
- the minimum button width
-