278 * }
279 * <i>//If there is an array of option buttons:</i>
280 * for(int counter = 0, maxCounter = options.length;
281 * counter < maxCounter; counter++) {
282 * if(options[counter].equals(selectedValue))
283 * return counter;
284 * }
285 * return CLOSED_OPTION;
286 * </pre>
287 * <p>
288 * <strong>Warning:</strong> Swing is not thread safe. For more
289 * information see <a
290 * href="package-summary.html#threading">Swing's Threading
291 * Policy</a>.
292 * <p>
293 * <strong>Warning:</strong>
294 * Serialized objects of this class will not be compatible with
295 * future Swing releases. The current serialization support is
296 * appropriate for short term storage or RMI between applications running
297 * the same version of Swing. As of 1.4, support for long term storage
298 * of all JavaBeans™
299 * has been added to the <code>java.beans</code> package.
300 * Please see {@link java.beans.XMLEncoder}.
301 *
302 * @see JInternalFrame
303 *
304 * @author James Gosling
305 * @author Scott Violet
306 * @since 1.2
307 */
308 @JavaBean(defaultProperty = "UI", description = "A component which implements standard dialog box controls.")
309 @SwingContainer
310 @SuppressWarnings("serial") // Same-version serialization only
311 public class JOptionPane extends JComponent implements Accessible
312 {
313 /**
314 * @see #getUIClassID
315 * @see #readObject
316 */
317 private static final String uiClassID = "OptionPaneUI";
318
2523 @BeanProperty(bound = false, expert = true, description
2524 = "The AccessibleContext associated with this option pane")
2525 public AccessibleContext getAccessibleContext() {
2526 if (accessibleContext == null) {
2527 accessibleContext = new AccessibleJOptionPane();
2528 }
2529 return accessibleContext;
2530 }
2531
2532 /**
2533 * This class implements accessibility support for the
2534 * <code>JOptionPane</code> class. It provides an implementation of the
2535 * Java Accessibility API appropriate to option pane user-interface
2536 * elements.
2537 * <p>
2538 * <strong>Warning:</strong>
2539 * Serialized objects of this class will not be compatible with
2540 * future Swing releases. The current serialization support is
2541 * appropriate for short term storage or RMI between applications running
2542 * the same version of Swing. As of 1.4, support for long term storage
2543 * of all JavaBeans™
2544 * has been added to the <code>java.beans</code> package.
2545 * Please see {@link java.beans.XMLEncoder}.
2546 */
2547 @SuppressWarnings("serial") // Same-version serialization only
2548 protected class AccessibleJOptionPane extends AccessibleJComponent {
2549
2550 /**
2551 * Get the role of this object.
2552 *
2553 * @return an instance of AccessibleRole describing the role of the object
2554 * @see AccessibleRole
2555 */
2556 public AccessibleRole getAccessibleRole() {
2557 switch (messageType) {
2558 case ERROR_MESSAGE:
2559 case INFORMATION_MESSAGE:
2560 case WARNING_MESSAGE:
2561 return AccessibleRole.ALERT;
2562
2563 default:
|
278 * }
279 * <i>//If there is an array of option buttons:</i>
280 * for(int counter = 0, maxCounter = options.length;
281 * counter < maxCounter; counter++) {
282 * if(options[counter].equals(selectedValue))
283 * return counter;
284 * }
285 * return CLOSED_OPTION;
286 * </pre>
287 * <p>
288 * <strong>Warning:</strong> Swing is not thread safe. For more
289 * information see <a
290 * href="package-summary.html#threading">Swing's Threading
291 * Policy</a>.
292 * <p>
293 * <strong>Warning:</strong>
294 * Serialized objects of this class will not be compatible with
295 * future Swing releases. The current serialization support is
296 * appropriate for short term storage or RMI between applications running
297 * the same version of Swing. As of 1.4, support for long term storage
298 * of all JavaBeans
299 * has been added to the <code>java.beans</code> package.
300 * Please see {@link java.beans.XMLEncoder}.
301 *
302 * @see JInternalFrame
303 *
304 * @author James Gosling
305 * @author Scott Violet
306 * @since 1.2
307 */
308 @JavaBean(defaultProperty = "UI", description = "A component which implements standard dialog box controls.")
309 @SwingContainer
310 @SuppressWarnings("serial") // Same-version serialization only
311 public class JOptionPane extends JComponent implements Accessible
312 {
313 /**
314 * @see #getUIClassID
315 * @see #readObject
316 */
317 private static final String uiClassID = "OptionPaneUI";
318
2523 @BeanProperty(bound = false, expert = true, description
2524 = "The AccessibleContext associated with this option pane")
2525 public AccessibleContext getAccessibleContext() {
2526 if (accessibleContext == null) {
2527 accessibleContext = new AccessibleJOptionPane();
2528 }
2529 return accessibleContext;
2530 }
2531
2532 /**
2533 * This class implements accessibility support for the
2534 * <code>JOptionPane</code> class. It provides an implementation of the
2535 * Java Accessibility API appropriate to option pane user-interface
2536 * elements.
2537 * <p>
2538 * <strong>Warning:</strong>
2539 * Serialized objects of this class will not be compatible with
2540 * future Swing releases. The current serialization support is
2541 * appropriate for short term storage or RMI between applications running
2542 * the same version of Swing. As of 1.4, support for long term storage
2543 * of all JavaBeans
2544 * has been added to the <code>java.beans</code> package.
2545 * Please see {@link java.beans.XMLEncoder}.
2546 */
2547 @SuppressWarnings("serial") // Same-version serialization only
2548 protected class AccessibleJOptionPane extends AccessibleJComponent {
2549
2550 /**
2551 * Get the role of this object.
2552 *
2553 * @return an instance of AccessibleRole describing the role of the object
2554 * @see AccessibleRole
2555 */
2556 public AccessibleRole getAccessibleRole() {
2557 switch (messageType) {
2558 case ERROR_MESSAGE:
2559 case INFORMATION_MESSAGE:
2560 case WARNING_MESSAGE:
2561 return AccessibleRole.ALERT;
2562
2563 default:
|