diff -r bdc3f1b79fb7 -r a00905527ec2 jdk/test/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/optionpane/OptionPaneDemo.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/optionpane/OptionPaneDemo.java Wed Mar 30 19:05:58 2016 -0700
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2007, 2016, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * 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 com.sun.swingset3.demos.optionpane;
+
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.net.URL;
+import javax.swing.*;
+
+import com.sun.swingset3.demos.ResourceManager;
+import com.sun.swingset3.DemoProperties;
+
+/**
+ * JOptionPaneDemo
+ *
+ * @author Jeff Dinkins
+ * @version 1.11 11/17/05
+ */
+@DemoProperties(
+ value = "JOptionPane Demo",
+ category = "Choosers",
+ description = "Demonstrates JOptionPane, a component which displays standard message dialogs (question, warning, error, etc).",
+ sourceFiles = {
+ "com/sun/swingset3/demos/optionpane/OptionPaneDemo.java",
+ "com/sun/swingset3/demos/ResourceManager.java",
+ "com/sun/swingset3/demos/optionpane/resources/OptionPaneDemo.properties",
+ "com/sun/swingset3/demos/optionpane/resources/images/bottle.gif",
+ "com/sun/swingset3/demos/optionpane/resources/images/OptionPaneDemo.gif"
+ }
+)
+public class OptionPaneDemo extends JPanel {
+
+ private static final Dimension VGAP15 = new Dimension(1, 15);
+ private static final Dimension VGAP30 = new Dimension(1, 30);
+
+ private static final ResourceManager resourceManager = new ResourceManager(OptionPaneDemo.class);
+ public static final String WARNING_TITLE = resourceManager.getString("OptionPaneDemo.warningtitle");
+ public static final String WARNING_TEXT = resourceManager.getString("OptionPaneDemo.warningtext");
+ public static final String WARNING_BUTTON = resourceManager.getString("OptionPaneDemo.warningbutton");
+ public static final String CONFIRM_NO = resourceManager.getString("OptionPaneDemo.confirmno");
+ public static final String CONFIRM_YES = resourceManager.getString("OptionPaneDemo.confirmyes");
+ public static final String CONFIRM_QUESTION = resourceManager.getString("OptionPaneDemo.confirmquestion");
+ public static final String CONFIRM_BUTTON = resourceManager.getString("OptionPaneDemo.confirmbutton");
+ public static final String MESSAGE_TEXT = resourceManager.getString("OptionPaneDemo.messagetext");
+ public static final String MESSAGE_BUTTON = resourceManager.getString("OptionPaneDemo.messagebutton");
+ public static final String INPUT_QUESTION = resourceManager.getString("OptionPaneDemo.inputquestion");
+ public static final String INPUT_RESPONSE = ": " + resourceManager.getString("OptionPaneDemo.inputresponse");
+ public static final String INPUT_BUTTON = resourceManager.getString("OptionPaneDemo.inputbutton");
+ public static final String COMPONENT_R4 = resourceManager.getString("OptionPaneDemo.component_r4");
+ public static final String COMPONENT_R3 = resourceManager.getString("OptionPaneDemo.component_r3");
+ public static final String COMPONENT_R2 = resourceManager.getString("OptionPaneDemo.component_r2");
+ public static final String COMPONENT_R1 = resourceManager.getString("OptionPaneDemo.component_r1");
+ public static final String COMPONENT_TITLE = resourceManager.getString("OptionPaneDemo.componenttitle");
+ public static final String COMPONENT_OP5 = resourceManager.getString("OptionPaneDemo.component_op5");
+ public static final String COMPONENT_OP4 = resourceManager.getString("OptionPaneDemo.component_op4");
+ public static final String COMPONENT_OP3 = resourceManager.getString("OptionPaneDemo.component_op3");
+ public static final String COMPONENT_OP2 = resourceManager.getString("OptionPaneDemo.component_op2");
+ public static final String COMPONENT_OP1 = resourceManager.getString("OptionPaneDemo.component_op1");
+ public static final String COMPONENT_MESSAGE_2 = resourceManager.getString("OptionPaneDemo.componentmessage2");
+ public static final String COMPONENT_CB3 = resourceManager.getString("OptionPaneDemo.component_cb3");
+ public static final String COMPONENT_CB2 = resourceManager.getString("OptionPaneDemo.component_cb2");
+ public static final String COMPONENT_CB1 = resourceManager.getString("OptionPaneDemo.component_cb1");
+ public static final String COMPONENT_BUTTON = resourceManager.getString("OptionPaneDemo.componentbutton");
+ public static final String COMPONENT_TEXT_FIELD = resourceManager.getString("OptionPaneDemo.componenttextfield");
+ public static final String COMPONENT_MESSAGE = resourceManager.getString("OptionPaneDemo.componentmessage");
+ public static final String DEMO_TITLE = OptionPaneDemo.class.getAnnotation(DemoProperties.class).value();
+
+ /**
+ * main method allows us to run as a standalone demo.
+ *
+ * @param args
+ */
+ public static void main(String[] args) {
+ JFrame frame = new JFrame(DEMO_TITLE);
+
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.getContentPane().add(new OptionPaneDemo());
+ frame.setPreferredSize(new Dimension(800, 600));
+ frame.pack();
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ }
+
+ /**
+ * OptionPaneDemo Constructor
+ */
+ public OptionPaneDemo() {
+ setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
+
+ JPanel bp = new JPanel() {
+ @Override
+ public Dimension getMaximumSize() {
+ return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
+ }
+ };
+ bp.setLayout(new BoxLayout(bp, BoxLayout.Y_AXIS));
+
+ bp.add(Box.createRigidArea(VGAP30));
+ bp.add(Box.createRigidArea(VGAP30));
+
+ bp.add(createInputDialogButton());
+ bp.add(Box.createRigidArea(VGAP15));
+ bp.add(createWarningDialogButton());
+ bp.add(Box.createRigidArea(VGAP15));
+ bp.add(createMessageDialogButton());
+ bp.add(Box.createRigidArea(VGAP15));
+ bp.add(createComponentDialogButton());
+ bp.add(Box.createRigidArea(VGAP15));
+ bp.add(createConfirmDialogButton());
+ bp.add(Box.createVerticalGlue());
+
+ add(Box.createHorizontalGlue());
+ add(bp);
+ add(Box.createHorizontalGlue());
+ }
+
+ private JButton createWarningDialogButton() {
+ Action a = new AbstractAction(WARNING_BUTTON) {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JOptionPane.showMessageDialog(OptionPaneDemo.this,
+ WARNING_TEXT,
+ WARNING_TITLE,
+ JOptionPane.WARNING_MESSAGE
+ );
+ }
+ };
+ return createButton(a);
+ }
+
+ private JButton createMessageDialogButton() {
+ Action a = new AbstractAction(MESSAGE_BUTTON) {
+ final URL img = getClass().getResource("resources/images/bottle.gif");
+ final String imagesrc = "";
+ final String message = MESSAGE_TEXT;
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JOptionPane.showMessageDialog(
+ OptionPaneDemo.this,
+ "" + imagesrc + "