< prev index next >

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

Print this page




 124             final int yLocation = container.getInsets().top;
 125 
 126             // Always syncAllWidths - and heights!
 127             final Dimension maxSize = new Dimension(kOKCancelButtonWidth, kButtonHeight);
 128             for (int i = 0; i < numChildren; i++) {
 129                 final Dimension sizes = children[i].getPreferredSize();
 130                 maxSize.width = Math.max(maxSize.width, sizes.width);
 131                 maxSize.height = Math.max(maxSize.height, sizes.height);
 132             }
 133 
 134             // ignore getCentersChildren, because we don't
 135             int xLocation = container.getSize().width - (maxSize.width * numChildren + (numChildren - 1) * padding);
 136             final int xOffset = maxSize.width + padding;
 137 
 138             // most important button (button zero) on far right
 139             for (int i = numChildren - 1; i >= 0; i--) {
 140                 children[i].setBounds(xLocation, yLocation, maxSize.width, maxSize.height);
 141                 xLocation += xOffset;
 142             }
 143         }


























 144     }
 145 }


 124             final int yLocation = container.getInsets().top;
 125 
 126             // Always syncAllWidths - and heights!
 127             final Dimension maxSize = new Dimension(kOKCancelButtonWidth, kButtonHeight);
 128             for (int i = 0; i < numChildren; i++) {
 129                 final Dimension sizes = children[i].getPreferredSize();
 130                 maxSize.width = Math.max(maxSize.width, sizes.width);
 131                 maxSize.height = Math.max(maxSize.height, sizes.height);
 132             }
 133 
 134             // ignore getCentersChildren, because we don't
 135             int xLocation = container.getSize().width - (maxSize.width * numChildren + (numChildren - 1) * padding);
 136             final int xOffset = maxSize.width + padding;
 137 
 138             // most important button (button zero) on far right
 139             for (int i = numChildren - 1; i >= 0; i--) {
 140                 children[i].setBounds(xLocation, yLocation, maxSize.width, maxSize.height);
 141                 xLocation += xOffset;
 142             }
 143         }
 144 
 145         @Override
 146         public Dimension minimumLayoutSize(Container c) {
 147             if (c != null) {
 148                 Component[] children = c.getComponents();
 149                 if (children != null && children.length > 0) {
 150                     int numChildren = children.length;
 151                     Insets cInsets = c.getInsets();
 152                     int extraHeight = cInsets.top + cInsets.bottom;
 153                     int extraWidth = cInsets.left + cInsets.right;
 154 
 155                     Dimension maxSize = new Dimension(kOKCancelButtonWidth,
 156                             kButtonHeight);
 157                     for (int i = 0; i < numChildren; i++) {
 158                         Dimension sizes = children[i].getPreferredSize();
 159                         maxSize.width = Math.max(maxSize.width, sizes.width);
 160                         maxSize.height = Math.max(maxSize.height, sizes.height);
 161                     }
 162                     return new Dimension(extraWidth
 163                             + (maxSize.width * numChildren)
 164                             + (numChildren - 1) * padding,
 165                             extraHeight + maxSize.height);
 166                 }
 167             }
 168             return new Dimension(0, 0);
 169         }
 170     }
 171 }
< prev index next >