< prev index next >

src/java.desktop/macosx/classes/com/apple/laf/AquaOptionPaneUI.java

Print this page

        

@@ -139,7 +139,33 @@
             for (int i = numChildren - 1; i >= 0; i--) {
                 children[i].setBounds(xLocation, yLocation, maxSize.width, maxSize.height);
                 xLocation += xOffset;
             }
         }
+
+        @Override
+        public Dimension minimumLayoutSize(Container c) {
+            if (c != null) {
+                Component[] children = c.getComponents();
+                if (children != null && children.length > 0) {
+                    int numChildren = children.length;
+                    Insets cInsets = c.getInsets();
+                    int extraHeight = cInsets.top + cInsets.bottom;
+                    int extraWidth = cInsets.left + cInsets.right;
+
+                    Dimension maxSize = new Dimension(kOKCancelButtonWidth,
+                            kButtonHeight);
+                    for (int i = 0; i < numChildren; i++) {
+                        Dimension sizes = children[i].getPreferredSize();
+                        maxSize.width = Math.max(maxSize.width, sizes.width);
+                        maxSize.height = Math.max(maxSize.height, sizes.height);
+                    }
+                    return new Dimension(extraWidth
+                            + (maxSize.width * numChildren)
+                            + (numChildren - 1) * padding,
+                            extraHeight + maxSize.height);
+                }
+            }
+            return new Dimension(0, 0);
+        }
     }
 }
< prev index next >