src/java.desktop/share/classes/javax/swing/JOptionPane.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 20,30 ****
*
* 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;
--- 20,29 ----
*** 33,42 ****
--- 32,43 ----
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,316 ****
* 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
*/
@SuppressWarnings("serial") // Same-version serialization only
public class JOptionPane extends JComponent implements Accessible
{
/**
* @see #getUIClassID
--- 300,315 ----
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see JInternalFrame
*
* @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
*** 1826,1840 ****
/**
* 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
*/
public void setUI(OptionPaneUI ui) {
if (this.ui != ui) {
super.setUI(ui);
invalidate();
}
--- 1825,1837 ----
/**
* 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
*/
+ @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();
}
*** 1867,1891 ****
*
* @return the string "OptionPaneUI"
* @see JComponent#getUIClassID
* @see UIDefaults#getUI
*/
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.
*/
public void setMessage(Object newMessage) {
Object oldMessage = message;
message = newMessage;
firePropertyChange(MESSAGE_PROPERTY, oldMessage, message);
--- 1864,1886 ----
*
* @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
*/
+ @BeanProperty(preferred = true, description
+ = "The optionpane's message object.")
public void setMessage(Object newMessage) {
Object oldMessage = message;
message = newMessage;
firePropertyChange(MESSAGE_PROPERTY, oldMessage, message);
*** 1905,1919 ****
* 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.
*/
public void setIcon(Icon newIcon) {
Object oldIcon = icon;
icon = newIcon;
firePropertyChange(ICON_PROPERTY, oldIcon, icon);
--- 1900,1912 ----
* 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
*/
+ @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);
*** 1932,1946 ****
/**
* 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.
*/
public void setValue(Object newValue) {
Object oldValue = value;
value = newValue;
firePropertyChange(VALUE_PROPERTY, oldValue, value);
--- 1925,1937 ----
/**
* Sets the value the user has chosen.
* @param newValue the chosen value
*
* @see #getValue
*/
+ @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);
*** 1973,1986 ****
* @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.
*/
public void setOptions(Object[] newOptions) {
Object[] oldOptions = options;
options = newOptions;
firePropertyChange(OPTIONS_PROPERTY, oldOptions, options);
--- 1964,1976 ----
* @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
*/
+ @BeanProperty(description
+ = "The option pane's options objects.")
public void setOptions(Object[] newOptions) {
Object[] oldOptions = options;
options = newOptions;
firePropertyChange(OPTIONS_PROPERTY, oldOptions, options);
*** 2010,2024 ****
*
* @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.
*/
public void setInitialValue(Object newInitialValue) {
Object oldIV = initialValue;
initialValue = newInitialValue;
firePropertyChange(INITIAL_VALUE_PROPERTY, oldIV, initialValue);
--- 2000,2012 ----
*
* @param newInitialValue the <code>Object</code> that gets the initial
* keyboard focus
*
* @see #getInitialValue
*/
+ @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);
*** 2046,2060 ****
* <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.
*/
public void setMessageType(int newType) {
checkMessageType(newType);
int oldType = messageType;
messageType = newType;
firePropertyChange(MESSAGE_TYPE_PROPERTY, oldType, messageType);
--- 2034,2046 ----
* <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
*/
+ @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);
*** 2095,2109 ****
* @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.
*/
public void setOptionType(int newType) {
checkOptionType(newType);
int oldType = optionType;
optionType = newType;
firePropertyChange(OPTION_TYPE_PROPERTY, oldType, optionType);
--- 2081,2093 ----
* @exception RuntimeException if <code>newType</code> is not one of
* the legal values listed above
*
* @see #getOptionType
* @see #setOptions
*/
+ @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);
*** 2147,2160 ****
* (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.
*/
public void setSelectionValues(Object[] newValues) {
Object[] oldValues = selectionValues;
selectionValues = newValues;
firePropertyChange(SELECTION_VALUES_PROPERTY, oldValues, newValues);
--- 2131,2143 ----
* (usually in a list or combo-box) from which
* the user can make a selection
* @see #setWantsInput
* @see #setInitialSelectionValue
* @see #getSelectionValues
*/
+ @BeanProperty(description
+ = "The option pane's selection values.")
public void setSelectionValues(Object[] newValues) {
Object[] oldValues = selectionValues;
selectionValues = newValues;
firePropertyChange(SELECTION_VALUES_PROPERTY, oldValues, newValues);
*** 2176,2189 ****
* 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.
*/
public void setInitialSelectionValue(Object newValue) {
Object oldValue = initialSelectionValue;
initialSelectionValue = newValue;
firePropertyChange(INITIAL_SELECTION_VALUE_PROPERTY, oldValue,
--- 2159,2171 ----
* 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
*/
+ @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,
*** 2213,2227 ****
* 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.
*/
public void setInputValue(Object newValue) {
Object oldValue = inputValue;
inputValue = newValue;
firePropertyChange(INPUT_VALUE_PROPERTY, oldValue, newValue);
--- 2195,2207 ----
* value that the user specified (usually in a text field)
* @see #setSelectionValues
* @see #setInitialSelectionValue
* @see #setWantsInput
* @see #getInputValue
*/
+ @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);
*** 2249,2258 ****
--- 2229,2239 ----
* 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;
}
/**
*** 2269,2283 ****
*
* @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.
*/
public void setWantsInput(boolean newValue) {
boolean oldValue = wantsInput;
wantsInput = newValue;
firePropertyChange(WANTS_INPUT_PROPERTY, oldValue, newValue);
--- 2250,2262 ----
*
* @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
*/
+ @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);
*** 2523,2536 ****
* <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
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJOptionPane();
}
return accessibleContext;
--- 2502,2514 ----
* <code>AccessibleJOptionPane</code>.
* A new <code>AccessibleJOptionPane</code> instance is created if necessary.
*
* @return an AccessibleJOptionPane that serves as the
* AccessibleContext of this AccessibleJOptionPane
*/
+ @BeanProperty(bound = false, expert = true, description
+ = "The AccessibleContext associated with this option pane")
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJOptionPane();
}
return accessibleContext;