jdk/src/share/classes/javax/swing/JOptionPane.java
changeset 1301 15e81207e1f2
parent 715 f16baef3a20e
child 5506 202f599c92aa
--- a/jdk/src/share/classes/javax/swing/JOptionPane.java	Tue Aug 26 12:16:23 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/JOptionPane.java	Tue Aug 26 15:12:54 2008 +0400
@@ -963,7 +963,7 @@
         }
         if (window instanceof SwingUtilities.SharedOwnerFrame) {
             WindowListener ownerShutdownListener =
-                (WindowListener)SwingUtilities.getSharedOwnerFrameShutdownListener();
+                    SwingUtilities.getSharedOwnerFrameShutdownListener();
             dialog.addWindowListener(ownerShutdownListener);
         }
         initDialog(dialog, style, parentComponent);
@@ -1300,11 +1300,10 @@
 
         // Use reflection to get Container.startLWModal.
         try {
-            Object obj;
-            obj = AccessController.doPrivileged(new ModalPrivilegedAction(
+            Method method = AccessController.doPrivileged(new ModalPrivilegedAction(
                     Container.class, "startLWModal"));
-            if (obj != null) {
-                ((Method)obj).invoke(dialog, (Object[])null);
+            if (method != null) {
+                method.invoke(dialog, (Object[])null);
             }
         } catch (IllegalAccessException ex) {
         } catch (IllegalArgumentException ex) {
@@ -1446,11 +1445,10 @@
 
         // Use reflection to get Container.startLWModal.
         try {
-            Object obj;
-            obj = AccessController.doPrivileged(new ModalPrivilegedAction(
+            Method method = AccessController.doPrivileged(new ModalPrivilegedAction(
                     Container.class, "startLWModal"));
-            if (obj != null) {
-                ((Method)obj).invoke(dialog, (Object[])null);
+            if (method != null) {
+                method.invoke(dialog, (Object[])null);
             }
         } catch (IllegalAccessException ex) {
         } catch (IllegalArgumentException ex) {
@@ -1531,12 +1529,11 @@
                         event.getPropertyName().equals(VALUE_PROPERTY)) {
                 // Use reflection to get Container.stopLWModal().
                 try {
-                    Object obj;
-                    obj = AccessController.doPrivileged(
+                    Method method = AccessController.doPrivileged(
                         new ModalPrivilegedAction(
                             Container.class, "stopLWModal"));
-                    if (obj != null) {
-                        ((Method)obj).invoke(iFrame, (Object[])null);
+                    if (method != null) {
+                        method.invoke(iFrame, (Object[])null);
                     }
                 } catch (IllegalAccessException ex) {
                 } catch (IllegalArgumentException ex) {
@@ -1852,7 +1849,7 @@
      * description: The UI object that implements the optionpane's LookAndFeel
      */
     public void setUI(OptionPaneUI ui) {
-        if ((OptionPaneUI)this.ui != ui) {
+        if (this.ui != ui) {
             super.setUI(ui);
             invalidate();
         }
@@ -2327,7 +2324,7 @@
 
     // Serialization support.
     private void writeObject(ObjectOutputStream s) throws IOException {
-        Vector      values = new Vector();
+        Vector<Object> values = new Vector<Object>();
 
         s.defaultWriteObject();
         // Save the icon, if its Serializable.
@@ -2342,7 +2339,7 @@
         }
         // Save the treeModel, if its Serializable.
         if(options != null) {
-            Vector           serOptions = new Vector();
+            Vector<Object> serOptions = new Vector<Object>();
 
             for(int counter = 0, maxCounter = options.length;
                 counter < maxCounter; counter++)
@@ -2510,16 +2507,16 @@
     /**
      * Retrieves a method from the provided class and makes it accessible.
      */
-    private static class ModalPrivilegedAction implements PrivilegedAction {
-        private Class clazz;
+    private static class ModalPrivilegedAction implements PrivilegedAction<Method> {
+        private Class<?> clazz;
         private String methodName;
 
-        public ModalPrivilegedAction(Class clazz, String methodName) {
+        public ModalPrivilegedAction(Class<?> clazz, String methodName) {
             this.clazz = clazz;
             this.methodName = methodName;
         }
 
-        public Object run() {
+        public Method run() {
             Method method = null;
             try {
                 method = clazz.getDeclaredMethod(methodName, (Class[])null);