jdk/src/share/classes/javax/swing/JOptionPane.java

Print this page

        

@@ -20,11 +20,10 @@
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package javax.swing;
 
 import java.awt.BorderLayout;
 import java.awt.Component;
 import java.awt.Container;

@@ -33,10 +32,12 @@
 import java.awt.KeyboardFocusManager;
 import java.awt.Frame;
 import java.awt.Point;
 import java.awt.HeadlessException;
 import java.awt.Window;
+import java.beans.JavaBean;
+import java.beans.BeanProperty;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.awt.event.WindowListener;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;

@@ -299,18 +300,16 @@
  * has been added to the <code>java.beans</code> package.
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @see JInternalFrame
  *
- * @beaninfo
- *      attribute: isContainer true
- *    description: A component which implements standard dialog box controls.
- *
  * @author James Gosling
  * @author Scott Violet
  * @since 1.2
  */
+@JavaBean(defaultProperty = "UI", description = "A component which implements standard dialog box controls.")
+@SwingContainer
 @SuppressWarnings("serial") // Same-version serialization only
 public class JOptionPane extends JComponent implements Accessible
 {
     /**
      * @see #getUIClassID

@@ -1824,15 +1823,13 @@
     /**
      * Sets the UI object which implements the {@literal L&F} for this component.
      *
      * @param ui  the <code>OptionPaneUI</code> {@literal L&F} object
      * @see UIDefaults#getUI
-     * @beaninfo
-     *       bound: true
-     *      hidden: true
-     * description: The UI object that implements the optionpane's LookAndFeel
      */
+    @BeanProperty(hidden = true, description
+            = "The UI object that implements the optionpane's LookAndFeel")
     public void setUI(OptionPaneUI ui) {
         if (this.ui != ui) {
             super.setUI(ui);
             invalidate();
         }

@@ -1865,25 +1862,23 @@
      *
      * @return the string "OptionPaneUI"
      * @see JComponent#getUIClassID
      * @see UIDefaults#getUI
      */
+    @BeanProperty(bound = false)
     public String getUIClassID() {
         return uiClassID;
     }
 
 
     /**
      * Sets the option pane's message-object.
      * @param newMessage the <code>Object</code> to display
      * @see #getMessage
-     *
-     * @beaninfo
-     *   preferred: true
-     *   bound: true
-     * description: The optionpane's message object.
      */
+    @BeanProperty(preferred = true, description
+            = "The optionpane's message object.")
     public void setMessage(Object newMessage) {
         Object           oldMessage = message;
 
         message = newMessage;
         firePropertyChange(MESSAGE_PROPERTY, oldMessage, message);

@@ -1903,15 +1898,13 @@
      * Sets the icon to display. If non-<code>null</code>, the look and feel
      * does not provide an icon.
      * @param newIcon the <code>Icon</code> to display
      *
      * @see #getIcon
-     * @beaninfo
-     *   preferred: true
-     *       bound: true
-     * description: The option pane's type icon.
      */
+    @BeanProperty(preferred = true, description
+            = "The option pane's type icon.")
     public void setIcon(Icon newIcon) {
         Object              oldIcon = icon;
 
         icon = newIcon;
         firePropertyChange(ICON_PROPERTY, oldIcon, icon);

@@ -1930,15 +1923,13 @@
     /**
      * Sets the value the user has chosen.
      * @param newValue  the chosen value
      *
      * @see #getValue
-     * @beaninfo
-     *   preferred: true
-     *       bound: true
-     * description: The option pane's value object.
      */
+    @BeanProperty(preferred = true, description
+            = "The option pane's value object.")
     public void setValue(Object newValue) {
         Object               oldValue = value;
 
         value = newValue;
         firePropertyChange(VALUE_PROPERTY, oldValue, value);

@@ -1971,14 +1962,13 @@
      * @param newOptions an array of <code>Objects</code> that create the
      *          buttons the user can click on, or arbitrary
      *          <code>Components</code> to add to the pane
      *
      * @see #getOptions
-     * @beaninfo
-     *       bound: true
-     * description: The option pane's options objects.
      */
+    @BeanProperty(description
+            = "The option pane's options objects.")
     public void setOptions(Object[] newOptions) {
         Object[]           oldOptions = options;
 
         options = newOptions;
         firePropertyChange(OPTIONS_PROPERTY, oldOptions, options);

@@ -2008,15 +1998,13 @@
      *
      * @param newInitialValue the <code>Object</code> that gets the initial
      *                         keyboard focus
      *
      * @see #getInitialValue
-     * @beaninfo
-     *   preferred: true
-     *       bound: true
-     * description: The option pane's initial value object.
      */
+    @BeanProperty(preferred = true, description
+            = "The option pane's initial value object.")
     public void setInitialValue(Object newInitialValue) {
         Object            oldIV = initialValue;
 
         initialValue = newInitialValue;
         firePropertyChange(INITIAL_VALUE_PROPERTY, oldIV, initialValue);

@@ -2044,15 +2032,13 @@
      *                <code>QUESTION_MESSAGE</code>, or <code>PLAIN_MESSAGE</code>
      * @exception RuntimeException if <code>newType</code> is not one of the
      *          legal values listed above
 
      * @see #getMessageType
-     * @beaninfo
-     *   preferred: true
-     *       bound: true
-     * description: The option pane's message type.
      */
+    @BeanProperty(preferred = true, description
+            = "The option pane's message type.")
     public void setMessageType(int newType) {
         checkMessageType(newType);
         int           oldType = messageType;
         messageType = newType;
         firePropertyChange(MESSAGE_TYPE_PROPERTY, oldType, messageType);

@@ -2093,15 +2079,13 @@
      * @exception RuntimeException if <code>newType</code> is not one of
      *          the legal values listed above
      *
      * @see #getOptionType
      * @see #setOptions
-     * @beaninfo
-     *   preferred: true
-     *       bound: true
-     * description: The option pane's option type.
       */
+    @BeanProperty(preferred = true, description
+            = "The option pane's option type.")
     public void setOptionType(int newType) {
         checkOptionType(newType);
         int            oldType = optionType;
         optionType = newType;
         firePropertyChange(OPTION_TYPE_PROPERTY, oldType, optionType);

@@ -2145,14 +2129,13 @@
      *                  (usually in a list or combo-box) from which
      *                  the user can make a selection
      * @see #setWantsInput
      * @see #setInitialSelectionValue
      * @see #getSelectionValues
-     * @beaninfo
-     *       bound: true
-     * description: The option pane's selection values.
      */
+    @BeanProperty(description
+            = "The option pane's selection values.")
     public void setSelectionValues(Object[] newValues) {
         Object[]           oldValues = selectionValues;
 
         selectionValues = newValues;
         firePropertyChange(SELECTION_VALUES_PROPERTY, oldValues, newValues);

@@ -2174,14 +2157,13 @@
      * Sets the input value that is initially displayed as selected to the user.
      * Only used if <code>wantsInput</code> is true.
      * @param newValue the initially selected value
      * @see #setSelectionValues
      * @see #getInitialSelectionValue
-     * @beaninfo
-     *       bound: true
-     * description: The option pane's initial selection value object.
      */
+    @BeanProperty(description
+            = "The option pane's initial selection value object.")
     public void setInitialSelectionValue(Object newValue) {
         Object          oldValue = initialSelectionValue;
 
         initialSelectionValue = newValue;
         firePropertyChange(INITIAL_SELECTION_VALUE_PROPERTY, oldValue,

@@ -2211,15 +2193,13 @@
      *          value that the user specified (usually in a text field)
      * @see #setSelectionValues
      * @see #setInitialSelectionValue
      * @see #setWantsInput
      * @see #getInputValue
-     * @beaninfo
-     *   preferred: true
-     *       bound: true
-     * description: The option pane's input value object.
      */
+    @BeanProperty(preferred = true, description
+            = "The option pane's input value object.")
     public void setInputValue(Object newValue) {
         Object              oldValue = inputValue;
 
         inputValue = newValue;
         firePropertyChange(INPUT_VALUE_PROPERTY, oldValue, newValue);

@@ -2247,10 +2227,11 @@
      * The value can be
      * changed by overriding this method in a subclass.
      *
      * @return an integer giving the maximum number of characters on a line
      */
+    @BeanProperty(bound = false)
     public int getMaxCharactersPerLineCount() {
         return Integer.MAX_VALUE;
     }
 
     /**

@@ -2267,15 +2248,13 @@
      *
      * @param newValue if true, an input component whose parent is {@code parentComponent}
      *                 is provided to allow the user to input a value.
      * @see #setSelectionValues
      * @see #setInputValue
-     * @beaninfo
-     *   preferred: true
-     *       bound: true
-     * description: Flag which allows the user to input a value.
      */
+    @BeanProperty(preferred = true, description
+            = "Flag which allows the user to input a value.")
     public void setWantsInput(boolean newValue) {
         boolean            oldValue = wantsInput;
 
         wantsInput = newValue;
         firePropertyChange(WANTS_INPUT_PROPERTY, oldValue, newValue);

@@ -2521,14 +2500,13 @@
      * <code>AccessibleJOptionPane</code>.
      * A new <code>AccessibleJOptionPane</code> instance is created if necessary.
      *
      * @return an AccessibleJOptionPane that serves as the
      *         AccessibleContext of this AccessibleJOptionPane
-     * @beaninfo
-     *       expert: true
-     *  description: The AccessibleContext associated with this option pane
      */
+    @BeanProperty(bound = false, expert = true, description
+            = "The AccessibleContext associated with this option pane")
     public AccessibleContext getAccessibleContext() {
         if (accessibleContext == null) {
             accessibleContext = new AccessibleJOptionPane();
         }
         return accessibleContext;