Class ExtButtonAreaLayout

All Implemented Interfaces:
LayoutManager

public final class ExtButtonAreaLayout extends BasicOptionPaneUI.ButtonAreaLayout
Unlike its superclass, this layout uses a minimum button width that complies with Mac and Windows UI style guides.
Version:
$Revision: 1.13 $
  • Constructor Details

    • ExtButtonAreaLayout

      public ExtButtonAreaLayout(boolean syncAllWidths, int padding)
      Constructs an ExtButtonAreaLayout.
      Parameters:
      syncAllWidths - true indicates that all buttons get the same size
      padding - the padding between buttons
  • Method Details

    • layoutContainer

      public void layoutContainer(Container container)
      Specified by:
      layoutContainer in interface LayoutManager
      Overrides:
      layoutContainer in class BasicOptionPaneUI.ButtonAreaLayout
    • minimumLayoutSize

      public Dimension minimumLayoutSize(Container c)
      Specified by:
      minimumLayoutSize in interface LayoutManager
      Overrides:
      minimumLayoutSize in class BasicOptionPaneUI.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 ButtonBarBuilder2 class.

      Returns:
      the minimum button width