This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui] Patch: javax.swing - some cleanups


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I just commited the attached patch to cleanup some little things in 
Swing I discovered while working on javax.swing.text.


Michael


2004-06-23  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JPopupMenu.java: Removed CVS tags.
	* javax/swing/UIDefaults.java: Reformatted.
	* javax/swing/plaf/basic/BasicRootPaneUI.java:
	Explicitely import used classes.

- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA2Ts+WSOgCCdjSDsRAn5qAJ9SvY3Pwir8QP0oPS1q02I9/kGkEgCgnpEd
PtbefeffRrQJMnebjafQccU=
=jvmQ
-----END PGP SIGNATURE-----
Index: javax/swing/JPopupMenu.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JPopupMenu.java,v
retrieving revision 1.3.8.9
diff -u -b -B -r1.3.8.9 JPopupMenu.java
--- javax/swing/JPopupMenu.java	17 Jun 2004 18:18:38 -0000	1.3.8.9
+++ javax/swing/JPopupMenu.java	23 Jun 2004 08:01:37 -0000
@@ -69,9 +69,6 @@
 
 /**
  * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision: 1.3.8.9 $
  */
 public class JPopupMenu extends JComponent implements Accessible, MenuElement
 {
Index: javax/swing/UIDefaults.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/UIDefaults.java,v
retrieving revision 1.7.2.1
diff -u -b -B -r1.7.2.1 UIDefaults.java
--- javax/swing/UIDefaults.java	22 Mar 2004 23:38:20 -0000	1.7.2.1
+++ javax/swing/UIDefaults.java	23 Jun 2004 08:01:37 -0000
@@ -44,7 +44,6 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.lang.reflect.Method;
-import java.lang.reflect.Constructor;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
@@ -75,7 +74,7 @@
   interface ActiveValue
   {
     Object createValue(UIDefaults table);
-  } // interface ActiveValue
+  }
 
   public static class LazyInputMap implements LazyValue
   {
@@ -94,12 +93,12 @@
         }
       return im;
     }
-  } // class LazyInputMap
+  }
 
   interface LazyValue
   {
     Object createValue(UIDefaults table);
-  } // interface LazyValue
+  }
 
   public static class ProxyLazyValue implements LazyValue
   {
@@ -114,9 +113,9 @@
             try
               {
                 return Class
-                  .forName (className)
-                  .getConstructor (new Class[] {})
-                  .newInstance (new Object[] {});
+                  .forName(className)
+                  .getConstructor(new Class[] {})
+                  .newInstance(new Object[] {});
               }
             catch (Exception e)
               {
@@ -149,25 +148,25 @@
         };
     }
     
-    public ProxyLazyValue (String c, Object[] os)
+    public ProxyLazyValue(String c, Object[] os)
     {
       final String className = c;
       final Object[] objs = os;
       final Class[] clss = new Class[objs.length];
       for (int i = 0; i < objs.length; ++i)
         {
-          clss[i] = objs[i].getClass ();
+          clss[i] = objs[i].getClass();
         }      
-      inner = new LazyValue ()
+      inner = new LazyValue()
         { 
-          public Object createValue (UIDefaults table) 
+          public Object createValue(UIDefaults table) 
           {            
             try
               {
                 return Class
-                  .forName (className)
-                  .getConstructor (clss)
-                  .newInstance (objs);
+                  .forName(className)
+                  .getConstructor(clss)
+                  .newInstance(objs);
     }
             catch (Exception e)
     {
@@ -177,7 +176,7 @@
         };
     }
 
-    public ProxyLazyValue (String c, String m, Object[] os)
+    public ProxyLazyValue(String c, String m, Object[] os)
     {
       final String className = c;
       final String methodName = m;
@@ -185,18 +184,18 @@
       final Class[] clss = new Class[objs.length];
       for (int i = 0; i < objs.length; ++i)
     {
-          clss[i] = objs[i].getClass ();
+          clss[i] = objs[i].getClass();
     }
-      inner = new LazyValue ()
+      inner = new LazyValue()
         { 
     public Object createValue(UIDefaults table)
     {
             try 
               {
                 return Class
-                  .forName (className)
-                  .getMethod (methodName, clss)
-                  .invoke (null, objs);
+                  .forName(className)
+                  .getMethod(methodName, clss)
+                  .invoke(null, objs);
               }
             catch (Exception e)
               {
@@ -206,60 +205,56 @@
         };
     }
     
-    public Object createValue (UIDefaults table)
+    public Object createValue(UIDefaults table)
     {
-      return inner.createValue (table);
+      return inner.createValue(table);
+    }
     }
-  } // class ProxyLazyValue
 
   private static final long serialVersionUID = 7341222528856548117L;
 
   public UIDefaults()
   {
-    bundles = new LinkedList ();
+    bundles = new LinkedList();
+    defaultLocale = Locale.getDefault();
     listeners = new HashSet ();
-    defaultLocale = Locale.getDefault ();
   }
 
   public UIDefaults(Object[] entries)
   {
-    bundles = new LinkedList ();
-    listeners = new HashSet ();
-    defaultLocale = Locale.getDefault ();
+    this();
 
-    for (int i = 0; (2*i+1) < entries.length; ++i)
-      {
-        put (entries[2*i], entries[2*i+1]);
-      }
+    for (int i = 0; (2 * i + 1) < entries.length; ++i)
+      put(entries[2 * i], entries[2 * i + 1]);
   }
 
   public Object get(Object key)
   {
-    return this.get (key, getDefaultLocale ());
+    return this.get(key, getDefaultLocale());
   }
 
-  public Object get (Object key, Locale loc)
+  public Object get(Object key, Locale loc)
   {
     Object obj = null;
 
-    if (super.containsKey (key))
+    if (super.containsKey(key))
       {
-        obj = super.get (key);
+        obj = super.get(key);
       }
     else if (key instanceof String)
       {
         String keyString = (String) key;
-        ListIterator i = bundles.listIterator (0);
-        while (i.hasNext ())
+        ListIterator i = bundles.listIterator(0);
+        while (i.hasNext())
   {
-            String bundle_name = (String) i.next ();
+            String bundle_name = (String) i.next();
             ResourceBundle res =
-              ResourceBundle.getBundle (bundle_name, loc);
+              ResourceBundle.getBundle(bundle_name, loc);
             if (res != null)
               {
                 try 
                   {                    
-                    obj = res.getObject (keyString);
+                    obj = res.getObject(keyString);
                     break;
                   }
                 catch (MissingResourceException me)
@@ -279,14 +274,14 @@
 
     if (obj instanceof LazyValue)
       {
-        Object resolved = ((LazyValue)obj).createValue (this);
-        super.remove (key);
-        super.put (key, resolved);
+        Object resolved = ((LazyValue) obj).createValue(this);
+        super.remove(key);
+        super.put(key, resolved);
         return resolved;
       }
     else if (obj instanceof ActiveValue)
       {
-        return ((ActiveValue)obj).createValue (this);
+        return ((ActiveValue) obj).createValue(this);
       }    
 
     return obj;
@@ -294,19 +289,19 @@
 
   public Object put(Object key, Object value)
   {
-    Object old = super.put (key, value);
+    Object old = super.put(key, value);
     if (key instanceof String && old != value)
-      firePropertyChange ((String) key, old, value);
+      firePropertyChange((String) key, old, value);
     return old;
   }
 
   public void putDefaults(Object[] entries)
   {
-    for (int i = 0; (2*i+1) < entries.length; ++i)
+    for (int i = 0; (2 * i + 1) < entries.length; ++i)
   {
-        super.put (entries[2*i], entries[2*i+1]);
+        super.put(entries[2 * i], entries[2 * i + 1]);
       }
-    firePropertyChange ("UIDefaults", null, null);
+    firePropertyChange("UIDefaults", null, null);
   }
 
   public Font getFont(Object key)
@@ -510,12 +504,12 @@
 
   void addResourceBundle(String name)
   {
-    bundles.addFirst (name);
+    bundles.addFirst(name);
   }
 
   void removeResourceBundle(String name)
   {
-    bundles.remove (name);
+    bundles.remove(name);
   }
 
   void setDefaultLocale(Locale loc)
@@ -527,4 +521,4 @@
   {
     return defaultLocale;
   }
-} // class UIDefaults
+}
Index: javax/swing/plaf/basic/BasicRootPaneUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicRootPaneUI.java,v
retrieving revision 1.1.2.1
diff -u -b -B -r1.1.2.1 BasicRootPaneUI.java
--- javax/swing/plaf/basic/BasicRootPaneUI.java	21 May 2004 23:34:15 -0000	1.1.2.1
+++ javax/swing/plaf/basic/BasicRootPaneUI.java	23 Jun 2004 08:01:37 -0000
@@ -1,5 +1,5 @@
 /* BasicPanelUI.java
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,9 +38,10 @@
 
 package javax.swing.plaf.basic;
 
-import javax.swing.*;
-import javax.swing.plaf.*;
-import java.awt.*;
+import javax.swing.JComponent;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.RootPaneUI;
 
 
 public class BasicRootPaneUI extends RootPaneUI

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]