jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaOptionPaneUI.java
author rchamyal
Thu, 21 Jan 2016 13:27:56 +0530
changeset 35690 c3df5280bc01
parent 35667 ed476aba94de
permissions -rw-r--r--
8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button Reviewed-by: alexsch, psadhukhan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 12047
diff changeset
     2
 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     4
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    10
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    15
 * accompanied this code).
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    16
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    20
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    23
 * questions.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    24
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    25
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    26
package com.apple.laf;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    27
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    28
import java.awt.*;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    29
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    30
import javax.swing.*;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    31
import javax.swing.plaf.ComponentUI;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    32
import javax.swing.plaf.basic.BasicOptionPaneUI;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    33
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    34
public class AquaOptionPaneUI extends BasicOptionPaneUI {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    35
    private static final int kOKCancelButtonWidth = 79;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    36
    private static final int kButtonHeight = 23;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    37
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    38
    private static final int kDialogSmallPadding = 4;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    39
    private static final int kDialogLargePadding = 23;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    40
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    41
    /**
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    42
     * Creates a new BasicOptionPaneUI instance.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    43
     */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    44
    public static ComponentUI createUI(final JComponent x) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    45
        return new AquaOptionPaneUI();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    46
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    47
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    48
    /**
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    49
     * Creates and returns a Container containin the buttons. The buttons
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    50
     * are created by calling {@code getButtons}.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    51
     */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    52
    protected Container createButtonArea() {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    53
        final Container bottom = super.createButtonArea();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    54
        // Now replace the Layout
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    55
        bottom.setLayout(new AquaButtonAreaLayout(true, kDialogSmallPadding));
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    56
        return bottom;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    57
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    58
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    59
    /**
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    60
     * Messaged from installComponents to create a Container containing the
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    61
     * body of the message.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    62
     * The icon and body should be aligned on their top edges
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    63
     */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    64
    protected Container createMessageArea() {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    65
        final JPanel top = new JPanel();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    66
        top.setBorder(UIManager.getBorder("OptionPane.messageAreaBorder"));
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    67
        top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS));
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    68
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    69
        /* Fill the body. */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    70
        final Container body = new JPanel();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    71
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    72
        final Icon sideIcon = getIcon();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    73
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    74
        if (sideIcon != null) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    75
            final JLabel iconLabel = new JLabel(sideIcon);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    76
            iconLabel.setVerticalAlignment(SwingConstants.TOP);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    77
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    78
            final JPanel iconPanel = new JPanel();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    79
            iconPanel.add(iconLabel);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    80
            top.add(iconPanel);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    81
            top.add(Box.createHorizontalStrut(kDialogLargePadding));
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    82
        }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    83
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    84
        body.setLayout(new GridBagLayout());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    85
        final GridBagConstraints cons = new GridBagConstraints();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    86
        cons.gridx = cons.gridy = 0;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    87
        cons.gridwidth = GridBagConstraints.REMAINDER;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    88
        cons.gridheight = 1;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    89
        cons.anchor = GridBagConstraints.WEST;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    90
        cons.insets = new Insets(0, 0, 3, 0);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    91
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    92
        addMessageComponents(body, cons, getMessage(), getMaxCharactersPerLineCount(), false);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    93
        top.add(body);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    94
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    95
        return top;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    96
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    97
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    98
    /**
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    99
     * AquaButtonAreaLayout lays out all
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   100
     *   components according to the HI Guidelines:
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   101
     * The most important button is always on the far right
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   102
     * The group of buttons is on the right for left-to-right,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   103
     *         left for right-to-left
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   104
     * The widths of each component will be set to the largest preferred size width.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   105
     *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   106
     *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   107
     * This inner class is marked "public" due to a compiler bug.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   108
     * This class should be treated as a "protected" inner class.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   109
     * Instantiate it only within subclasses of BasicOptionPaneUI.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   110
     *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   111
     * BasicOptionPaneUI expects that its buttons are layed out with
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   112
     * a subclass of ButtonAreaLayout
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   113
     */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   114
    public static class AquaButtonAreaLayout extends ButtonAreaLayout {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   115
        public AquaButtonAreaLayout(final boolean syncAllWidths, final int padding) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   116
            super(true, padding);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   117
        }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   118
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   119
        public void layoutContainer(final Container container) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   120
            final Component[] children = container.getComponents();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   121
            if (children == null || 0 >= children.length) return;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   122
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   123
            final int numChildren = children.length;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   124
            final int yLocation = container.getInsets().top;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   125
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   126
            // Always syncAllWidths - and heights!
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   127
            final Dimension maxSize = new Dimension(kOKCancelButtonWidth, kButtonHeight);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   128
            for (int i = 0; i < numChildren; i++) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   129
                final Dimension sizes = children[i].getPreferredSize();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   130
                maxSize.width = Math.max(maxSize.width, sizes.width);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   131
                maxSize.height = Math.max(maxSize.height, sizes.height);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   132
            }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   133
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   134
            // ignore getCentersChildren, because we don't
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   135
            int xLocation = container.getSize().width - (maxSize.width * numChildren + (numChildren - 1) * padding);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   136
            final int xOffset = maxSize.width + padding;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   137
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   138
            // most important button (button zero) on far right
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   139
            for (int i = numChildren - 1; i >= 0; i--) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   140
                children[i].setBounds(xLocation, yLocation, maxSize.width, maxSize.height);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   141
                xLocation += xOffset;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   142
            }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   143
        }
35690
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   144
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   145
        @Override
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   146
        public Dimension minimumLayoutSize(Container c) {
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   147
            if (c != null) {
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   148
                Component[] children = c.getComponents();
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   149
                if (children != null && children.length > 0) {
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   150
                    int numChildren = children.length;
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   151
                    Insets cInsets = c.getInsets();
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   152
                    int extraHeight = cInsets.top + cInsets.bottom;
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   153
                    int extraWidth = cInsets.left + cInsets.right;
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   154
                    int okCancelButtonWidth = extraWidth
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   155
                            + (kOKCancelButtonWidth * numChildren)
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   156
                            + (numChildren - 1) * padding;
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   157
                    int okbuttonHeight = extraHeight + kButtonHeight;
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   158
                    Dimension minSize = super.minimumLayoutSize(c);
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   159
                    return new Dimension(Math.max(minSize.width,
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   160
                            okCancelButtonWidth),
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   161
                            Math.max(minSize.height, okbuttonHeight));
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   162
                }
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   163
            }
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   164
            return new Dimension(0, 0);
c3df5280bc01 8139213: [macosx] Mac OS X Aqua Look and Feel: JOptionPane can truncate the first button
rchamyal
parents: 35667
diff changeset
   165
        }
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   166
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   167
}