2362N/A * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Provides the basic look and feel for a <code>JOptionPane</code>. 0N/A * <code>BasicMessagePaneUI</code> provides a means to place an icon, 0N/A * message and buttons into a <code>Container</code>. 0N/A * Generally, the layout will look like:<p> 0N/A * ------------------ 0N/A * ------------------ 0N/A * |________________| 0N/A * icon is an instance of <code>Icon</code> that is wrapped inside a 0N/A * <code>JLabel</code>. The message is an opaque object and is tested 0N/A * for the following: if the message is a <code>Component</code> it is 0N/A * added to the <code>Container</code>, if it is an <code>Icon</code> 0N/A * it is wrapped inside a <code>JLabel</code> and added to the 0N/A * <code>Container</code> otherwise it is wrapped inside a <code>JLabel</code>. 0N/A * The above layout is used when the option pane's 0N/A * <code>ComponentOrientation</code> property is horizontal, left-to-right. 0N/A * The layout will be adjusted appropriately for other orientations. 0N/A * The <code>Container</code>, message, icon, and buttons are all 0N/A * determined from abstract methods. 0N/A * @author James Gosling 0N/A * @author Scott Violet 0N/A * @author Amy Fowler 0N/A * <code>JOptionPane</code> that the receiver is providing the 0N/A * look and feel for. 0N/A /** JComponent provide for input if optionPane.getWantsInput() returns 0N/A /** Component to receive focus when messaged with selectInitialValue. */ 0N/A /** This is set to true in validateComponent if a Component is contained 0N/A * in either the message or the buttons. */ 0N/A * Creates a new BasicOptionPaneUI instance. 0N/A * Installs the receiver as the L&F for the passed in 0N/A * <code>JOptionPane</code>. 0N/A * Removes the receiver from the L&F controller of the passed in split 0N/A "OptionPane.foreground",
"OptionPane.font");
0N/A "OptionPane.actionMap");
0N/A * Returns the minimum size the option pane should be. Primarily 0N/A * provided for subclassers wishing to offer a different minimum size. 0N/A * If <code>c</code> is the <code>JOptionPane</code> the receiver 0N/A * is contained in, the preferred 0N/A * size that is returned is the maximum of the preferred size of 0N/A * the <code>LayoutManager</code> for the <code>JOptionPane</code>, and 0N/A * <code>getMinimumOptionPaneSize</code>. 0N/A * Messaged from installComponents to create a Container containing the 0N/A * body of the message. The icon is the created by calling 0N/A * <code>addIcon</code>. 0N/A "OptionPane.messageAreaBorder");
0N/A /* Fill the body. */ 0N/A * Creates the appropriate object to represent <code>msg</code> and 0N/A * places it into <code>container</code>. If <code>msg</code> is an 0N/A * instance of Component, it is added directly, if it is an Icon, 0N/A * a JLabel is created to represent it, otherwise a JLabel is 0N/A * created for the string, if <code>d</code> is an Object[], this 0N/A * method will be recursively invoked for the children. 0N/A * <code>internallyCreated</code> is true if Objc is an instance 0N/A * of Component and was created internally by this method (this is 0N/A * used to correctly set hasCustomComponents only if !internallyCreated). 0N/A // To workaround problem where Gridbad will set child 0N/A // to its minimum size if its preferred size will not fit 0N/A // within allocated cells 0N/A // break up newlines 0N/A * Returns the message to display from the JOptionPane the receiver is 0N/A * providing the look and feel for. 0N/A /* Create a user component to capture the input. If the 0N/A selectionValues are non null the component and there 0N/A are < 20 values it'll be a combobox, if non null and 0N/A >= 20, it'll be a list, otherwise it'll be a textfield. */ 0N/A * Creates and adds a JLabel representing the icon returned from 0N/A * <code>getIcon</code> to <code>top</code>. This is messaged from 0N/A * <code>createMessageArea</code> 0N/A /* Create the icon. */ 0N/A * Returns the icon from the JOptionPane the receiver is providing 0N/A * the look and feel for, or the default icon as returned from 0N/A * <code>getDefaultIcon</code>. 0N/A * Returns the icon to use for the passed in type. 0N/A * Returns the maximum number of characters to place on a line. 0N/A * Recursively creates new JLabel instances to represent <code>d</code>. 0N/A * Each JLabel instance is added to <code>c</code>. 0N/A // Primitive line wrapping 0N/A * Creates and returns a Container containing the buttons. The buttons 0N/A * are created by calling <code>getButtons</code>. 0N/A "OptionPane.buttonAreaBorder");
0N/A "OptionPane.sameSizeButtons",
true),
0N/A * Creates the appropriate object to represent each of the objects in 0N/A * <code>buttons</code> and adds it to <code>container</code>. This 0N/A * differs from addMessageComponents in that it will recurse on 0N/A * <code>buttons</code> and that if button is not a Component 0N/A * it will create an instance of JButton. 0N/A /* Set the padding, windows seems to use 8 if <= 2 components, 0N/A otherwise 4 is used. It may actually just be the size of the 0N/A buttons is always the same, not sure. */ 0N/A * Returns the buttons to display from the JOptionPane the receiver is 0N/A * providing the look and feel for. If the JOptionPane has options 0N/A * set, they will be provided, otherwise if the optionType is 0N/A * YES_NO_OPTION, yesNoOptions is returned, if the type is 0N/A * YES_NO_CANCEL_OPTION yesNoCancelOptions is returned, otherwise 0N/A * defaultButtons are returned. 0N/A "OptionPane.buttonMinimumWidth",-
1);
0N/A * Returns true, basic L&F wants all the buttons to have the same 0N/A * Returns the initial index into the buttons to select. The index 0N/A * is calculated from the initial value from the JOptionPane and 0N/A * options of the JOptionPane or 0. 0N/A * Sets the input value in the option pane the receiver is providing 0N/A * the look and feel for based on the value in the inputComponent. 0N/A * If inputComponent is non-null, the focus is requested on that, 0N/A * otherwise request focus on the default value 0N/A * Returns true if in the last call to validateComponent the message 0N/A * or buttons contained a subclass of Component. 0N/A * <code>ButtonAreaLayout</code> behaves in a similar manner to 0N/A * <code>FlowLayout</code>. It lays out all components from left to 0N/A * right. If <code>syncAllWidths</code> is true, the widths of each 0N/A * component will be set to the largest preferred size width. 0N/A * This class should be treated as a "protected" inner class. 3972N/A * Instantiate it only within subclasses of {@code BasicOptionPaneUI}. 0N/A /** If true, children are lumped together in parent. */ 0N/A * Indicates whether or not centersChildren should be used vs 0N/A * the orientation. This is done for backward compatability 0N/A * This class should be treated as a "protected" inner class. 3972N/A * Instantiate it only within subclasses of {@code BasicOptionPaneUI}. 0N/A * If the source of the PropertyChangeEvent <code>e</code> equals the 0N/A * optionPane and is one of the ICON_PROPERTY, MESSAGE_PROPERTY, 0N/A * OPTIONS_PROPERTY or INITIAL_VALUE_PROPERTY, 0N/A * validateComponent is invoked. 0N/A * used representing the message. 0N/A "OptionPane.messageForeground");
0N/A "OptionPane.messageFont");
0N/A * used representing the button portion of the optionpane. 0N/A "OptionPane.buttonFont");
0N/A * This class should be treated as a "protected" inner class. 3972N/A * Instantiate it only within subclasses of {@code BasicOptionPaneUI}. 0N/A /* If the option pane takes input, then store the input value 0N/A * if custom options were specified, if the option type is 0N/A * DEFAULT_OPTION, OR if option type is set to a predefined 0N/A * one and the user chose the affirmative answer. 0N/A // PropertyChangeListener 0N/A // Option Pane Auditory Cue Activation 0N/A // only respond to "ancestor" changes 0N/A // the idea being that a JOptionPane gets a JDialog when it is 0N/A // set to appear and loses it's JDialog when it is dismissed. 0N/A // if the old value is null, then the JOptionPane is being 0N/A // created since it didn't previously have an ancestor. 0N/A // figure out what to do based on the message type 0N/A "OptionPane.informationSound");
0N/A "OptionPane.questionSound");
0N/A "OptionPane.informationSound");
0N/A "OptionPane.warningSound");
0N/A "OptionPane.errorSound");
0N/A // Classes used when optionPane.getWantsInput returns true. 0N/A * A JTextField that allows you to specify an array of KeyStrokes that 0N/A * that will have their bindings processed regardless of whether or 0N/A * not they are registered on the JTextField. This is used as we really 0N/A * want the ActionListener to be notified so that we can push the 0N/A * change to the JOptionPane, but we also want additional bindings 0N/A * (those of the JRootPane) to be processed as well. 0N/A * Sets the KeyStrokes that will be additional processed for 0N/A * ancestor bindings. 0N/A // Returning false will allow further processing 0N/A // of the bindings, eg our parent Containers will get a 0N/A * Registered in the ActionMap. Sets the value of the option pane 0N/A * to <code>JOptionPane.CLOSED_OPTION</code>. 0N/A * This class is used to create the default buttons. This indirection is 0N/A * used so that addButtonComponents can tell which Buttons were created 0N/A * by us vs subclassers or from the JOptionPane itself.