harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r441863 [1/5] - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/ test/api/java/common/java/awt/
Date Sat, 09 Sep 2006 21:56:50 GMT
Author: ndbeyer
Date: Sat Sep  9 14:56:46 2006
New Revision: 441863

URL: http://svn.apache.org/viewvc?view=rev&rev=441863
Log:
Code cleanup for 'java.awt'; add braces, remove compiler warnings, add documentation, etc

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTEvent.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTEventMulticaster.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTKeyStroke.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AlphaComposite.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BasicStroke.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BorderLayout.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BufferCapabilities.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Button.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Canvas.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CardLayout.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Checkbox.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CheckboxGroup.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CheckboxMenuItem.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Choice.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ChoicePopupBox.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ComponentOrientation.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Container.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ContainerOrderFocusTraversalPolicy.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Cursor.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/DefaultFocusTraversalPolicy.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/DefaultKeyboardFocusManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/DefaultMouseDragGestureRecognizer.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Dialog.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Dimension.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Dispatcher.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/DisplayMode.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EmbeddedWindow.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Event.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventDispatchThread.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventQueueCore.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/EventQueueThread.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/FileDialog.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/FlowLayout.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/FocusDispatcher.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/FontMetrics.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Frame.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Graphics.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Graphics2D.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GraphicsConfiguration.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GraphicsDevice.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridBagConstraints.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridBagLayout.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridLayout.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Image.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ImageCapabilities.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Insets.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/JobAttributes.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/KeyboardFocusManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Label.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MediaTracker.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Menu.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuBar.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuComponent.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuItem.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MenuShortcut.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MouseDispatcher.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/PageAttributes.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Panel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Point.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/PopupBox.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/PopupMenu.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/PrintJob.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Rectangle.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/RedrawManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/RenderingHints.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Robot.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ScrollPane.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ScrollPaneAdjustable.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Scrollbar.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/SystemColor.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TextArea.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TextComponent.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TextField.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TexturePaint.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Toolkit.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ToolkitImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Window.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ContainerRTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTEvent.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTEvent.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTEvent.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTEvent.java Sat Sep  9 14:56:46 2006
@@ -67,9 +67,9 @@
 
     public static final int RESERVED_ID_MAX = 1999;
 
-    private static final Hashtable eventsMap = new Hashtable();
+    private static final Hashtable<Integer, EventDescriptor> eventsMap = new Hashtable<Integer, EventDescriptor>();
 
-    private static EventConverter converter = null;
+    private static EventConverter converter;
 
     protected int id;
 
@@ -183,6 +183,7 @@
         source = newSource;
     }
 
+    @Override
     public String toString() {
         /* The format is based on 1.5 release behavior 
          * which can be revealed by the following code:
@@ -265,9 +266,9 @@
 
         final long eventMask;
 
-        final Class listenerType;
+        final Class<?> listenerType;
 
-        EventDescriptor(long eventMask, Class listenerType) {
+        EventDescriptor(long eventMask, Class<?> listenerType) {
             this.eventMask = eventMask;
             this.listenerType = listenerType;
         }
@@ -281,7 +282,7 @@
             synchronized (this) {
                 if (event != lastEvent) {
                     lastEvent = event;
-                    lastEventDescriptor = (EventDescriptor) eventsMap.get(new Integer(event.id));
+                    lastEventDescriptor = eventsMap.get(new Integer(event.id));
                 }
 
                 return lastEventDescriptor;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTEventMulticaster.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTEventMulticaster.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTEventMulticaster.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTEventMulticaster.java Sat Sep  9 14:56:46 2006
@@ -65,18 +65,16 @@
         s.writeObject(l);
     }
 
-    public static EventListener[] getListeners(EventListener l,
-            Class listenerType) throws ClassCastException
-    {
+    public static EventListener[] getListeners(EventListener l, Class<?> listenerType)
+            throws ClassCastException {
         if (l == null) {
             return new EventListener[0];
-        } else {
-            return (EventListener[]) addListeners(l, listenerType, new LinkedList()).toArray
-                    ((EventListener[]) java.lang.reflect.Array.newInstance(listenerType, 0));
         }
+        return addListeners(l, listenerType, new LinkedList<EventListener>()).toArray(
+                (EventListener[]) java.lang.reflect.Array.newInstance(listenerType, 0));
     }
 
-    private static LinkedList addListeners(EventListener l, Class listenerType, LinkedList list) {
+    private static LinkedList<EventListener> addListeners(EventListener l, Class<?> listenerType, LinkedList<EventListener> list) {
         if (l instanceof AWTEventMulticaster) {
             AWTEventMulticaster ml = (AWTEventMulticaster) l;
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTKeyStroke.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTKeyStroke.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTKeyStroke.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTKeyStroke.java Sat Sep  9 14:56:46 2006
@@ -18,6 +18,7 @@
  * @version $Revision$
  */
 package java.awt;
+import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
@@ -31,21 +32,21 @@
 public class AWTKeyStroke implements Serializable {
     private static final long serialVersionUID = -6430539691155161871L;
 
-    private char keyChar;
-    private int keyCode;
-    private int modifiers;
-    private boolean onKeyRelease;
-    private static AWTKeyStroke cacheKey = new AWTKeyStroke();
-    private static Map cache = new HashMap(); //Map<AWTKeyStroke, ? extends AWTKeyStroke>
-    private static Map keyEventTypesMap = new HashMap(); //Map<int, String>
-    private static Constructor subConstructor;
+    private static final Map<AWTKeyStroke, AWTKeyStroke> cache = new HashMap<AWTKeyStroke, AWTKeyStroke>(); //Map<AWTKeyStroke, ? extends AWTKeyStroke>
+    private static final Map<Integer, String> keyEventTypesMap = new HashMap<Integer, String>(); //Map<int, String>
+    private static Constructor<?> subConstructor;
+    
     static {
         keyEventTypesMap.put(new Integer(KeyEvent.KEY_PRESSED), "pressed");
         keyEventTypesMap.put(new Integer(KeyEvent.KEY_RELEASED), "released");
         keyEventTypesMap.put(new Integer(KeyEvent.KEY_TYPED), "typed");
-
     }
 
+    private char keyChar;
+    private int keyCode;
+    private int modifiers;
+    private boolean onKeyRelease;
+    
     protected AWTKeyStroke(char keyChar, int keyCode, int modifiers,
             boolean onKeyRelease)
     {
@@ -64,6 +65,7 @@
         this(KeyEvent.CHAR_UNDEFINED, KeyEvent.VK_UNDEFINED, 0, false);
     }
 
+    @Override
     public int hashCode() {
         return modifiers + ( keyCode != KeyEvent.VK_UNDEFINED ?
                 keyCode : keyChar) + (onKeyRelease ? -1 : 0);
@@ -73,6 +75,7 @@
         return modifiers;
     }
 
+    @Override
     public final boolean equals(Object anObject) {
         if (anObject instanceof AWTKeyStroke) {
             AWTKeyStroke key = (AWTKeyStroke)anObject;
@@ -83,10 +86,11 @@
         return false;
     }
 
+    @Override
     public String toString() {
         int type = getKeyEventType();
-        return KeyEvent.getModifiersExText(getModifiers()) + " " +
-            (String) keyEventTypesMap.get(new Integer(type)) +  " " +
+        return InputEvent.getModifiersExText(getModifiers()) + " " +
+            keyEventTypesMap.get(new Integer(type)) +  " " +
             (type == KeyEvent.KEY_TYPED ? new String(new char[] {keyChar}) :
                                           KeyEvent.getKeyText(keyCode));
     }
@@ -104,7 +108,7 @@
                                                 boolean onKeyRelease) {
         AWTKeyStroke key = newInstance(keyChar, keyCode, modifiers, onKeyRelease);
 
-        AWTKeyStroke value = (AWTKeyStroke)cache.get(key);
+        AWTKeyStroke value = cache.get(key);
         if (value == null) {
             value = key;
             cache.put(key, value);
@@ -120,7 +124,7 @@
             key = new AWTKeyStroke();
         } else {
             try {
-                key = (AWTKeyStroke) subConstructor.newInstance(null);
+                key = (AWTKeyStroke) subConstructor.newInstance();
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
@@ -141,11 +145,11 @@
      */
     static int getAllModifiers(int mod) {
         int allMod = mod;
-        int shift = (KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK);
-        int ctrl = (KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK);
-        int meta = (KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK);
-        int alt = (KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK);
-        int altGr = (KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK);
+        int shift = (InputEvent.SHIFT_MASK | InputEvent.SHIFT_DOWN_MASK);
+        int ctrl = (InputEvent.CTRL_MASK | InputEvent.CTRL_DOWN_MASK);
+        int meta = (InputEvent.META_MASK | InputEvent.META_DOWN_MASK);
+        int alt = (InputEvent.ALT_MASK | InputEvent.ALT_DOWN_MASK);
+        int altGr = (InputEvent.ALT_GRAPH_MASK | InputEvent.ALT_GRAPH_DOWN_MASK);
         // button modifiers are not converted between old & new
 
         allMod = addMask(allMod, shift);
@@ -268,7 +272,7 @@
                                this.modifiers, this.onKeyRelease);
     }
 
-    protected static void registerSubclass(Class subclass) {
+    protected static void registerSubclass(Class<?> subclass) {
         if (subclass == null) {
             throw new IllegalArgumentException("subclass cannot be null");
         }
@@ -276,7 +280,7 @@
             throw new ClassCastException("subclass is not derived from AWTKeyStroke");
         }
         try {
-            subConstructor = subclass.getDeclaredConstructor(null);
+            subConstructor = subclass.getDeclaredConstructor();
             subConstructor.setAccessible(true);
         } catch (SecurityException e) {
             throw new RuntimeException(e);
@@ -289,21 +293,21 @@
     private static long parseModifier(String strMod) {
         long modifiers = 0l;
         if (strMod.equals("shift")) {
-            modifiers |= KeyEvent.SHIFT_DOWN_MASK;
+            modifiers |= InputEvent.SHIFT_DOWN_MASK;
         } else if (strMod.equals("control") || strMod.equals("ctrl")) {
-            modifiers |= KeyEvent.CTRL_DOWN_MASK;
+            modifiers |= InputEvent.CTRL_DOWN_MASK;
         } else if (strMod.equals("meta")) {
-            modifiers |= KeyEvent.META_DOWN_MASK;
+            modifiers |= InputEvent.META_DOWN_MASK;
         } else if (strMod.equals("alt")) {
-            modifiers |= KeyEvent.ALT_DOWN_MASK;
+            modifiers |= InputEvent.ALT_DOWN_MASK;
         } else if (strMod.equals("altGraph")) {
-            modifiers |= KeyEvent.ALT_GRAPH_DOWN_MASK;
+            modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
         } else if (strMod.equals("button1")) {
-            modifiers |= KeyEvent.BUTTON1_DOWN_MASK;
+            modifiers |= InputEvent.BUTTON1_DOWN_MASK;
         } else if (strMod.equals("button2")) {
-            modifiers |= KeyEvent.BUTTON2_DOWN_MASK;
+            modifiers |= InputEvent.BUTTON2_DOWN_MASK;
         } else if (strMod.equals("button3")) {
-            modifiers |= KeyEvent.BUTTON3_DOWN_MASK;
+            modifiers |= InputEvent.BUTTON3_DOWN_MASK;
         }
         return modifiers;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AlphaComposite.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AlphaComposite.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AlphaComposite.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AlphaComposite.java Sat Sep  9 14:56:46 2006
@@ -81,10 +81,12 @@
     private float alpha;
 
     private AlphaComposite(int rule, float alpha){
-        if(rule < CLEAR || rule > XOR)
+        if(rule < CLEAR || rule > XOR) {
             throw new IllegalArgumentException("Unknown rule");
-        if(alpha < 0.0f || alpha > 1.0f)
+        }
+        if(alpha < 0.0f || alpha > 1.0f) {
             throw new IllegalArgumentException("Wrong alpha value");
+        }
 
         this.rule = rule;
         this.alpha = alpha;
@@ -99,12 +101,16 @@
         return new ICompositeContext(this, srcColorModel, dstColorModel);
     }
 
+    @Override
     public boolean equals(Object obj) {
-        if(!(obj instanceof AlphaComposite)) return false;
+        if(!(obj instanceof AlphaComposite)) {
+            return false;
+        }
         AlphaComposite other = (AlphaComposite)obj;
         return (this.rule == other.getRule() && this.alpha == other.getAlpha());
     }
 
+    @Override
     public int hashCode() {
         int hash = Float.floatToIntBits(alpha);
         int tmp = hash >>> 24;
@@ -123,7 +129,9 @@
     }
 
     public static AlphaComposite getInstance(int rule, float alpha) {
-        if(alpha == 1.0f) return getInstance(rule);
+        if(alpha == 1.0f) {
+            return getInstance(rule);
+        }
         return new AlphaComposite(rule, alpha);
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BasicStroke.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BasicStroke.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BasicStroke.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BasicStroke.java Sat Sep  9 14:56:46 2006
@@ -44,7 +44,7 @@
     static final double CUBIC_ARC = 4.0 / 3.0 * (Math.sqrt(2.0) - 1);
 
     /**
-     * Strokw width
+     * Stroke width
      */
     float width;
     
@@ -54,7 +54,7 @@
     int cap;
     
     /**
-     * Strok join type
+     * Stroke join type
      */
     int join;
     
@@ -74,7 +74,7 @@
     float dashPhase;
 
     /**
-     * The tempopary pre-calculated values
+     * The temporary pre-calculated values
      */
     double curveDelta;
     double cornerDelta;
@@ -86,14 +86,14 @@
     double mx, my, cx, cy;
 
     /**
-     * The tempopary indicators
+     * The temporary indicators
      */
     boolean isMove;
     boolean isFirst;
     boolean checkMove;
     
     /**
-     * The tempopary and destination work paths
+     * The temporary and destination work paths
      */
     BufferedPath dst, lp, rp, sp;
     
@@ -182,6 +182,7 @@
         return dashPhase;
     }
 
+    @Override
     public int hashCode() {
         HashCode hash = new HashCode();
         hash.append(width);
@@ -190,13 +191,14 @@
         hash.append(miterLimit);
         if (dash != null) {
             hash.append(dashPhase);
-            for(int i = 0; i < dash.length; i++) {
-                hash.append(dash[i]);
+            for (float element : dash) {
+                hash.append(element);
             }
         }
         return hash.hashCode();
     }
 
+    @Override
     public boolean equals(Object obj) {
         if (obj == this) {
             return true;
@@ -481,13 +483,12 @@
                     p.setLast(x3, y3);
                 }
                 return;
-            } else {
-                // Zero corner
-                if (-zeroDelta < sin0 && sin0 < zeroDelta) {
-                    p.lineTo(x2, y2);
-                }
-                return;
             }
+            // Zero corner
+            if (-zeroDelta < sin0 && sin0 < zeroDelta) {
+                p.lineTo(x2, y2);
+            }
+            return;
         }
 
         if (isLeft ^ (sin0 < 0.0)) {
@@ -1415,9 +1416,8 @@
                 if (visible) {
                     pos -= iter.length;
                     return true;
-                } else {
-                    close = pos == iter.length;
                 }
+                close = pos == iter.length;
             }
             return false;
         }
@@ -1454,6 +1454,7 @@
                 length = len;
             }
 
+            @Override
             double getNext(double dashPos) {
                 return dashPos / length;
             }
@@ -1482,8 +1483,6 @@
                 double ay = y1 + y3 - y2 - y2;
                 double bx = 2.0 * (x2 - x1);
                 double by = 2.0 * (y2 - y1);
-                double cx = x1;
-                double cy = y1;
 
                 double dx1 = step * (step * ax + bx);
                 double dy1 = step * (step * ay + by);
@@ -1515,6 +1514,7 @@
                 prevLen = 0.0;
             }
 
+            @Override
             double getNext(double dashPos) {
                 double t = 2.0;
                 while (curLen <= dashPos && valPos < valSize) {
@@ -1556,8 +1556,6 @@
                 double by = 3.0 * (y1 + y3 - y2 - y2);
                 double cx = 3.0 * (x2 - x1);
                 double cy = 3.0 * (y2 - y1);
-                double dx = x1;
-                double dy = y1;
 
                 double dx1 = step * (step * (step * ax + bx) + cx);
                 double dy1 = step * (step * (step * ay + by) + cy);
@@ -1593,6 +1591,7 @@
                 prevLen = 0.0;
             }
 
+            @Override
             double getNext(double dashPos) {
                 double t = 2.0;
                 while (curLen <= dashPos && valPos < valSize) {
@@ -1619,7 +1618,6 @@
     static class BufferedPath {
 
         private static final int bufCapacity = 10;
-        private static final int initBufSize = 10;
 
         static int pointShift[] = {
                 2,  // MOVETO

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BorderLayout.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BorderLayout.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BorderLayout.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BorderLayout.java Sat Sep  9 14:56:46 2006
@@ -19,9 +19,15 @@
  */
 package java.awt;
 
-import java.io.*;
-import java.util.*;
-import java.lang.Math;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
 
 import org.apache.harmony.awt.FieldsAccessor;
 
@@ -43,7 +49,7 @@
     public static final String EAST = "East";
     public static final String WEST = "West";
 
-    private static final HashSet supportedConstraints = new HashSet();
+    private static final Set<String> supportedConstraints = new HashSet<String>();
 
     private static final int DEFAULT_GAP = 0;
     private static final int MAX_COMPONENTS = 5;
@@ -58,9 +64,9 @@
 
     private final transient Toolkit toolkit;
 
-    private final LinkedList components;
-    private final HashMap components2Constraints;
-    private final HashMap constraints2Components;
+    private final LinkedList<Component> components;
+    private final Map<Component, Object> components2Constraints;
+    private final Map<Object, Component> constraints2Components;
 
     private int hGap;
     private int vGap;
@@ -91,9 +97,9 @@
 
         toolkit.lockAWT();
         try {
-            components = new LinkedList();
-            components2Constraints = new HashMap();
-            constraints2Components = new HashMap();
+            components = new LinkedList<Component>();
+            components2Constraints = new HashMap<Component, Object>();
+            constraints2Components = new HashMap<Object, Component>();
 
             hGap = hgap;
             vGap = vgap;
@@ -140,7 +146,7 @@
                 return;
             }
 
-            comp2Forget = (Component) constraints2Components.get(cons);
+            comp2Forget = constraints2Components.get(cons);
             if (comp2Forget != null) {
                 forgetComponent(comp2Forget, cons);
             }
@@ -190,7 +196,7 @@
                         "Unsupported constraints object: " + constraints);
             }
 
-            return (Component) constraints2Components.get(constraints);
+            return constraints2Components.get(constraints);
         } finally {
             toolkit.unlockAWT();
         }
@@ -207,18 +213,18 @@
         } else if (WEST.equals(constraints)) {
             return getComponent(l2r ? LINE_START : LINE_END, WEST);
         } else if (CENTER.equals(constraints)) {
-            return (Component) constraints2Components.get(CENTER);
+            return constraints2Components.get(CENTER);
         }
         throw new IllegalArgumentException("cannot get component: " +
                                            "invalid constraint: " + constraints);
     }
 
     private Component getComponent(Object relCons, Object absCons) {
-        Component comp = (Component) constraints2Components.get(relCons);
+        Component comp = constraints2Components.get(relCons);
         if (comp != null) {
             return comp;
         }
-        return (Component) constraints2Components.get(absCons);
+        return constraints2Components.get(absCons);
     }
     
     public Object getConstraints(Component comp) {
@@ -336,6 +342,7 @@
         }
     }
 
+    @Override
     public String toString() {
         /* The format is based on 1.5 release behavior 
          * which can be revealed by the following code:
@@ -407,9 +414,7 @@
         Arrays.fill(visibleComponents, null);
         visibleComponentsNumber = 0;
 
-        for (Iterator i = components.iterator(); i.hasNext(); ) {
-            Component comp = (Component) i.next();
-
+        for (Component comp : components) {
             if (comp.isVisible()) {
                 int index = constraints2Index(components2Constraints.get(comp),
                         target.getComponentOrientation());

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BufferCapabilities.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BufferCapabilities.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BufferCapabilities.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/BufferCapabilities.java Sat Sep  9 14:56:46 2006
@@ -31,14 +31,16 @@
 
     public BufferCapabilities(ImageCapabilities frontBufferCapabilities, 
             ImageCapabilities backBufferCapabilities, FlipContents flipContents) {
-        if (frontBufferCapabilities == null || backBufferCapabilities == null)
+        if (frontBufferCapabilities == null || backBufferCapabilities == null) {
             throw new IllegalArgumentException();
+        }
 
         this.frontBufferCapabilities = frontBufferCapabilities;
         this.backBufferCapabilities = backBufferCapabilities;
         this.flipContents = flipContents;
     }
 
+    @Override
     public Object clone() {
         return new BufferCapabilities(frontBufferCapabilities, backBufferCapabilities, flipContents);
     }
@@ -77,10 +79,12 @@
 
         }
 
+        @Override
         public int hashCode() {
             return super.hashCode();
         }
 
+        @Override
         public String toString() {
             return super.toString();
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Button.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Button.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Button.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Button.java Sat Sep  9 14:56:46 2006
@@ -77,18 +77,22 @@
             return new Integer(0);
         }
 
+        @Override
         public AccessibleAction getAccessibleAction() {
             return this;
         }
 
+        @Override
         public String getAccessibleName() {
             return getLabel();
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.PUSH_BUTTON;
         }
 
+        @Override
         public AccessibleValue getAccessibleValue() {
             return this;
         }
@@ -114,6 +118,7 @@
             return stateController.isPressed();
         }
 
+        @Override
         public void calculate() {
             toolkit.theme.calculateButton(state);
         }
@@ -168,6 +173,7 @@
         }
     }
 
+    @Override
     void setFontImpl(Font f) {
         super.setFontImpl(f);
         if (isDisplayable()) {
@@ -175,6 +181,7 @@
         }
     }
 
+    @Override
     boolean hasDefaultFont() {
         return true;
     }
@@ -188,6 +195,7 @@
         }
     }
 
+    @Override
     public void addNotify() {
         toolkit.lockAWT();
         try {
@@ -217,12 +225,12 @@
         }
     }
 
+    @Override
     public EventListener[] getListeners(Class listenerType) {
         if (ActionListener.class.isAssignableFrom(listenerType)) {
             return getActionListeners();
-        } else {
-            return super.getListeners(listenerType);
         }
+        return super.getListeners(listenerType);
     }
 
     public void addActionListener(ActionListener l) {
@@ -238,6 +246,7 @@
         return (ActionListener[]) actionListeners.getUserListeners(new ActionListener[0]);
     }
 
+    @Override
     protected void processEvent(AWTEvent e) {
         if (toolkit.eventTypeLookup.getEventMask(e) == AWTEvent.ACTION_EVENT_MASK) {
             processActionEvent((ActionEvent) e);
@@ -258,6 +267,7 @@
         }
     }
 
+    @Override
     protected String paramString() {
         toolkit.lockAWT();
         try {
@@ -272,10 +282,12 @@
         return labelSize;
     }
 
+    @Override
     void prepaint(Graphics g) {
         toolkit.theme.drawButton(g, state);
     }
 
+    @Override
     boolean isPrepainter() {
         return true;
     }
@@ -284,6 +296,7 @@
         return stateController.isPressed();
     }
 
+    @Override
     void setEnabledImpl(boolean value) {
         super.setEnabledImpl(value);
         repaint();
@@ -294,10 +307,12 @@
                 getActionCommand(), timestamp, modifiers));
     }
 
+    @Override
     String autoName() {
         return ("button" + Integer.toString(toolkit.autoNumber.nextButton++));
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         toolkit.lockAWT();
         try {
@@ -307,6 +322,7 @@
         }
     }
 
+    @Override
     Dimension getDefaultMinimumSize() {
         if (getFont() == null) {
             return new Dimension(0, 0);
@@ -317,10 +333,12 @@
         return state.getDefaultMinimumSize();
     }
 
+    @Override
     void resetDefaultSize() {
         state.reset();
     }
 
+    @Override
     ComponentBehavior createBehavior() {
         return new HWBehavior(this);
     }
@@ -328,6 +346,7 @@
     ButtonStateController createStateController() {
 
         return new ButtonStateController(this) {
+            @Override
             protected void fireEvent() {
                 generateEvent(getWhen(), getMod());
             }};
@@ -343,6 +362,7 @@
         accessor.set("state", new State());
     }
 
+    @Override
     AccessibleContext createAccessibleContext() {
         return new AccessibleAWTButton();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Canvas.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Canvas.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Canvas.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Canvas.java Sat Sep  9 14:56:46 2006
@@ -30,6 +30,7 @@
     protected class AccessibleAWTCanvas extends AccessibleAWTComponent {
         private static final long serialVersionUID = -6325592262103146699L;
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.CANVAS;
         }
@@ -52,6 +53,7 @@
         }
     }
 
+    @Override
     public void update(Graphics g) {
         toolkit.lockAWT();
         try {
@@ -61,6 +63,7 @@
         }
     }
 
+    @Override
     public void addNotify() {
         toolkit.lockAWT();
         try {
@@ -76,7 +79,9 @@
         } finally {
             toolkit.unlockAWT();
         }
-        if (true) throw new RuntimeException("Method is not implemented"); //TODO: implement
+        if (true) {
+            throw new RuntimeException("Method is not implemented"); //TODO: implement
+        }
         return;
     }
 
@@ -86,10 +91,13 @@
         } finally {
             toolkit.unlockAWT();
         }
-        if (true) throw new RuntimeException("Method is not implemented"); //TODO: implement
+        if (true) {
+            throw new RuntimeException("Method is not implemented"); //TODO: implement
+        }
         return;
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         return super.getAccessibleContext();
     }
@@ -100,10 +108,13 @@
         } finally {
             toolkit.unlockAWT();
         }
-        if (true) throw new RuntimeException("Method is not implemented"); //TODO: implement
+        if (true) {
+            throw new RuntimeException("Method is not implemented"); //TODO: implement
+        }
         return null;
     }
 
+    @Override
     public void paint(Graphics g) {
         toolkit.lockAWT();
         try {
@@ -113,14 +124,17 @@
         }
     }
 
+    @Override
     ComponentBehavior createBehavior() {
         return new HWBehavior(this);
     }
 
+    @Override
     String autoName() {
         return ("canvas" + toolkit.autoNumber.nextCanvas++);
     }
 
+    @Override
     AccessibleContext createAccessibleContext() {
         return new AccessibleAWTCanvas();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CardLayout.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CardLayout.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CardLayout.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CardLayout.java Sat Sep  9 14:56:46 2006
@@ -30,8 +30,8 @@
     private int vGap;
     private int hGap;
 
-    private Hashtable nameTable;        //Name to component
-    private Hashtable compTable;        //Component to name
+    private Hashtable<String, Component> nameTable;        //Name to component
+    private Hashtable<Component, String> compTable;        //Component to name
     private int curComponent;
 
     private final Toolkit toolkit = Toolkit.getDefaultToolkit();
@@ -42,8 +42,8 @@
             vGap = vgap;
             hGap = hgap;
 
-            nameTable = new Hashtable();
-            compTable = new Hashtable();
+            nameTable = new Hashtable<String, Component>();
+            compTable = new Hashtable<Component, String>();
             curComponent = 0;
         } finally {
             toolkit.unlockAWT();
@@ -59,6 +59,7 @@
         }
     }
 
+    @Override
     public String toString() {
         /* The format is based on 1.5 release behavior 
          * which can be revealed by the following code:
@@ -175,7 +176,7 @@
                 }
             }
 
-            String name = (String) compTable.get(comp);
+            String name = compTable.get(comp);
             if (name != null) {
                 nameTable.remove(name);
             }
@@ -327,7 +328,7 @@
                 return;
             }
 
-            Component comp = (Component) nameTable.get(name);
+            Component comp = nameTable.get(name);
 
             if (comp == null) {
                 return;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Checkbox.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Checkbox.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Checkbox.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Checkbox.java Sat Sep  9 14:56:46 2006
@@ -53,10 +53,12 @@
             addItemListener(this);
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.CHECK_BOX;
         }
 
+        @Override
         public AccessibleStateSet getAccessibleStateSet() {
             AccessibleStateSet aStateSet = super.getAccessibleStateSet();
             if (getState()) {
@@ -65,10 +67,12 @@
             return aStateSet;
         }
 
+        @Override
         public AccessibleAction getAccessibleAction() {
             return this;
         }
 
+        @Override
         public AccessibleValue getAccessibleValue() {
             return this;
         }
@@ -150,6 +154,7 @@
             return stateController.isPressed();
         }
 
+        @Override
         public void calculate() {
             toolkit.theme.calculateCheckbox(state);
         }
@@ -237,6 +242,7 @@
         }
     }
 
+    @Override
     public void addNotify() {
         toolkit.lockAWT();
         try {
@@ -246,6 +252,7 @@
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         toolkit.lockAWT();
         try {
@@ -255,6 +262,7 @@
         }
     }
 
+    @Override
     protected String paramString() {
         /* The format is based on 1.5 release behavior 
          * which can be revealed by the following code:
@@ -293,9 +301,8 @@
         try {
             if (checked) {
                 return new Object[] { label };
-            } else {
-                return null;
             }
+            return null;
         } finally {
             toolkit.unlockAWT();
         }
@@ -361,14 +368,14 @@
         repaint();
     }
 
+    @Override
     public EventListener[] getListeners(Class listenerType) {
         toolkit.lockAWT();
         try {
             if (ItemListener.class.isAssignableFrom(listenerType)) {
                 return getItemListeners();
-            } else {
-                return super.getListeners(listenerType);
             }
+            return super.getListeners(listenerType);
         } finally {
             toolkit.unlockAWT();
         }
@@ -401,6 +408,7 @@
         }
     }
 
+    @Override
     protected void processEvent(AWTEvent e) {
         toolkit.lockAWT();
         try {
@@ -432,23 +440,28 @@
         }
     }
 
+    @Override
     boolean isPrepainter() {
         return true;
     }
 
+    @Override
     void prepaint(Graphics g) {
         toolkit.theme.drawCheckbox(g, state);
     }
 
+    @Override
     void setEnabledImpl(boolean value) {
         super.setEnabledImpl(value);
         repaint();
     }
 
+    @Override
     String autoName() {
         return ("checkbox" + toolkit.autoNumber.nextCheckBox++);
     }
 
+    @Override
     Dimension getDefaultMinimumSize() {
         if (getFont() == null) {
             return new Dimension(0, 0);
@@ -456,10 +469,12 @@
         return state.getDefaultMinimumSize();
     }
 
+    @Override
     void resetDefaultSize() {
         state.reset();
     }
 
+    @Override
     ComponentBehavior createBehavior() {
         return new HWBehavior(this);
     }
@@ -467,6 +482,7 @@
     ButtonStateController createStateController() {
 
         return new ButtonStateController(this) {
+            @Override
             protected void fireEvent() {
                 generateEvent();
             }};
@@ -483,6 +499,7 @@
     }
 
 
+    @Override
     AccessibleContext createAccessibleContext() {
         return new AccessibleAWTCheckbox();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CheckboxGroup.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CheckboxGroup.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CheckboxGroup.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CheckboxGroup.java Sat Sep  9 14:56:46 2006
@@ -36,6 +36,7 @@
         }
     }
 
+    @Override
     public String toString() {
         /* The format is based on 1.5 release behavior 
          * which can be revealed by the following code:
@@ -84,6 +85,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public Checkbox getCurrent() {
         toolkit.lockAWT();
         try {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CheckboxMenuItem.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CheckboxMenuItem.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CheckboxMenuItem.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/CheckboxMenuItem.java Sat Sep  9 14:56:46 2006
@@ -34,42 +34,52 @@
             implements AccessibleAction, AccessibleValue {
         private static final long serialVersionUID = -1122642964303476L;
 
+        @Override
         public boolean doAccessibleAction(int i) {
             return false; //do nothing
         }
 
+        @Override
         public AccessibleAction getAccessibleAction() {
             return this;
         }
 
+        @Override
         public int getAccessibleActionCount() {
             return 0; // no accessible actions
         }
 
+        @Override
         public String getAccessibleActionDescription(int i) {
             return null;
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.CHECK_BOX;
         }
 
+        @Override
         public AccessibleValue getAccessibleValue() {
             return this;
         }
 
+        @Override
         public Number getCurrentAccessibleValue() {
             return null;
         }
 
+        @Override
         public Number getMaximumAccessibleValue() {
             return null;
         }
 
+        @Override
         public Number getMinimumAccessibleValue() {
             return null;
         }
 
+        @Override
         public boolean setCurrentAccessibleValue(Number n) {
             return false;
         }
@@ -112,6 +122,7 @@
         }
     }
 
+    @Override
     public void addNotify() {
         toolkit.lockAWT();
         try {
@@ -121,6 +132,7 @@
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         toolkit.lockAWT();
         try {
@@ -130,6 +142,7 @@
         }
     }
 
+    @Override
     public String paramString() {
         /* The format of paramString is based on 1.5 release behavior 
          * which can be revealed using the following code:
@@ -164,12 +177,12 @@
         }
     }
 
+    @Override
     public EventListener[] getListeners(Class listenerType) {
         if (ItemListener.class.isAssignableFrom(listenerType)) {
             return getItemListeners();
-        } else {
-            return super.getListeners(listenerType);
         }
+        return super.getListeners(listenerType);
     }
 
     public void addItemListener(ItemListener l) {
@@ -184,6 +197,7 @@
         return (ItemListener[]) itemListeners.getUserListeners(new ItemListener[0]);
     }
 
+    @Override
     protected void processEvent(AWTEvent e) {
         if (toolkit.eventTypeLookup.getEventMask(e) == AWTEvent.ITEM_EVENT_MASK) {
             processItemEvent((ItemEvent) e);
@@ -204,16 +218,19 @@
         }
     }
 
+    @Override
     AccessibleContext createAccessibleContext() {
         return new AccessibleAWTCheckboxMenuItem();
     }
 
+    @Override
     void itemSelected(long when, int modifiers) {
         checked = !checked;
 
         super.itemSelected(when, modifiers);
     }
 
+    @Override
     AWTEvent createEvent(long when, int modifiers) {
         int state = checked ? ItemEvent.SELECTED : ItemEvent.DESELECTED;
         return new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, getLabel(), state);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Choice.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Choice.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Choice.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Choice.java Sat Sep  9 14:56:46 2006
@@ -49,7 +49,7 @@
 
     private final AWTListenerList itemListeners = new AWTListenerList(this);
 
-    private ArrayList items = new ArrayList();
+    private ArrayList<String> items = new ArrayList<String>();
 
     int selectedIndex = -1;
 
@@ -68,9 +68,11 @@
             // default constructor is public
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.COMBO_BOX;
         }
+        @Override
         public AccessibleAction getAccessibleAction() {
             return this;
         }
@@ -136,11 +138,13 @@
             return new ChoicePopupBox(Choice.this);
         }
 
+        @Override
         public void focusLost(FocusEvent fe) {
             super.focusLost(fe);
             popup.hide();
         }
 
+        @Override
         public void keyPressed(KeyEvent e) {
             boolean alt = e.isAltDown();
             int blockSize = ChoicePopupBox.PAGE_SIZE - 1;
@@ -190,6 +194,7 @@
             selectAndFire(newSel);
         }
 
+        @Override
         public void keyReleased(KeyEvent e) {
             // don't call super here as in keyPressed
         }
@@ -197,6 +202,7 @@
         /**
          * Called on mouse release
          */
+        @Override
         protected void fireEvent() {
             popup();
         }
@@ -213,6 +219,7 @@
             }
         }
 
+        @Override
         public void mousePressed(MouseEvent me) {
             super.mousePressed(me);
             // TODO: show/hide popup here
@@ -351,6 +358,7 @@
         }
     }
 
+    @Override
     public void addNotify() {
         toolkit.lockAWT();
         try {
@@ -361,6 +369,7 @@
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         toolkit.lockAWT();
         try {
@@ -370,6 +379,7 @@
         }
     }
 
+    @Override
     protected String paramString() {
         /* The format is based on 1.5 release behavior 
          * which can be revealed by the following code:
@@ -389,9 +399,8 @@
         try {
             if (items.size() > 0) {
                 return new Object[] {items.get(selectedIndex)};
-            } else {
-                return null;
             }
+            return null;
         } finally {
             toolkit.unlockAWT();
         }
@@ -400,7 +409,7 @@
     public String getItem(int index) {
         toolkit.lockAWT();
         try {
-            return (String)items.get(index);
+            return items.get(index);
         } finally {
             toolkit.unlockAWT();
         }
@@ -418,6 +427,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public int countItems() {
         toolkit.lockAWT();
         try {
@@ -451,7 +461,7 @@
             if (selectedIndex < 0) {
                 return null;
             }
-            return (String)items.get(selectedIndex);
+            return items.get(selectedIndex);
         } finally {
             toolkit.unlockAWT();
         }
@@ -483,12 +493,12 @@
         }
     }
 
+    @Override
     public EventListener[] getListeners(Class listenerType) {
         if (ItemListener.class.isAssignableFrom(listenerType)) {
             return getItemListeners();
-        } else {
-            return super.getListeners(listenerType);
         }
+        return super.getListeners(listenerType);
     }
 
     public void addItemListener(ItemListener l) {
@@ -503,6 +513,7 @@
         return (ItemListener[]) itemListeners.getUserListeners(new ItemListener[0]);
     }
 
+    @Override
     protected void processEvent(AWTEvent e) {
         if (toolkit.eventTypeLookup.getEventMask(e) == AWTEvent.ITEM_EVENT_MASK) {
             processItemEvent((ItemEvent) e);
@@ -512,7 +523,7 @@
     }
 
     protected void processItemEvent(ItemEvent e) {
-        for (Iterator i = itemListeners.getUserIterator(); i.hasNext();) {
+        for (Iterator<?> i = itemListeners.getUserIterator(); i.hasNext();) {
             ItemListener listener = (ItemListener) i.next();
 
             switch (e.getID()) {
@@ -523,10 +534,12 @@
         }
     }
 
+    @Override
     ComponentBehavior createBehavior() {
         return new HWBehavior(this);
     }
 
+    @Override
     String autoName() {
         return ("choice" + toolkit.autoNumber.nextChoice++);
     }
@@ -535,6 +548,7 @@
      * Widest list item must fit into Choice minimum
      * size
      */
+    @Override
     Dimension getDefaultMinimumSize() {
         Dimension minSize = new Dimension();
         if (!isDisplayable()) {
@@ -563,15 +577,18 @@
     }
 
 
+    @Override
     boolean isPrepainter() {
         return true;
     }
 
+    @Override
     void prepaint(Graphics g) {
         toolkit.theme.drawChoice(g, state);
     }
 
 
+    @Override
     void setFontImpl(Font f) {
         super.setFontImpl(f);
         setSize(getWidth(), getDefaultMinimumSize().height);
@@ -609,6 +626,7 @@
         return Math.min(getItemCount() - 1, Math.max(0, idx));
     }
 
+    @Override
     AccessibleContext createAccessibleContext() {
         return new AccessibleAWTChoice();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ChoicePopupBox.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ChoicePopupBox.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ChoicePopupBox.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ChoicePopupBox.java Sat Sep  9 14:56:46 2006
@@ -19,6 +19,7 @@
  */
 package java.awt;
 
+import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseWheelEvent;
@@ -115,6 +116,7 @@
             return focusedItem;
         }
 
+        @Override
         public Dimension getSize() {
             return ChoicePopupBox.this.getSize();
         }
@@ -201,6 +203,7 @@
         style = choice.popupStyle;
         vAdj = new ScrollPaneAdjustable(choice, Adjustable.VERTICAL) {
             private static final long serialVersionUID = 2280561825998835980L;
+            @Override
             void repaintComponent(Rectangle r) {
                 if (isVisible()) {
                     repaint(r);
@@ -260,6 +263,7 @@
     /**
      * Paints popup list and vertical scrollbar(if necessary)
      */
+    @Override
     void paint(Graphics g) {
         toolkit.theme.drawList(g, listState, true);
         if (scroll) {
@@ -354,6 +358,7 @@
     }
 
 
+    @Override
     void onKeyEvent(int eventId, int vKey, long when, int modifiers) {
         if (eventId == KeyEvent.KEY_PRESSED) {
             switch (vKey) {
@@ -413,6 +418,7 @@
     /**
      * Handles all mouse events on popup window
      */
+    @Override
     void onMouseEvent(int eventId, Point where, int mouseButton, long when,
                       int modifiers, int wheelRotation) {
 
@@ -432,7 +438,7 @@
             break;
         case MouseEvent.MOUSE_DRAGGED:
             // scroll on mouse drag
-            if ((modifiers & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
+            if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
                 dragScroll(y);
             }
         case MouseEvent.MOUSE_MOVED:
@@ -528,6 +534,7 @@
         repaint(null);
     }
 
+    @Override
     boolean closeOnUngrab(Point start, Point end) {
         if (!getBounds().contains(end)) {
             // close on mouse ungrab only
@@ -539,6 +546,7 @@
     }
 
 
+    @Override
     void hide() {
         // stop timer before closing:
         if (scroll && dragScrollTimer.isRunning()) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Color.java Sat Sep  9 14:56:46 2006
@@ -99,14 +99,14 @@
     /**
      * Float sRGB value.
      */
-    private float[] frgbvalue = null;
+    private float[] frgbvalue;
 
     /**
      * Color in an arbitrary color space
      * with <code>float</code> components.
      * If null, other value should be used.
      */
-    private float fvalue[] = null;
+    private float fvalue[];
 
     /**
      * Float alpha value. If frgbvalue is null, this is not valid data.
@@ -116,7 +116,7 @@
     /**
      * The color's color space if applicable.
      */
-    private ColorSpace cs = null;
+    private ColorSpace cs;
 
     /*
      * The value of the SCALE_FACTOR is based on 1.5 release behavior which
@@ -146,17 +146,15 @@
                 throw new IllegalArgumentException(
                         "Color parameter outside of expected range: " +
                         "component " + i + ".");
-            } else {
-                fvalue[i] = components[i];
             }
+            fvalue[i] = components[i];
         }
 
         if (alpha < 0.0f || alpha > 1.0f) {
             throw new IllegalArgumentException(
                     "Alpha value outside of expected range.");
-        } else {
-            falpha = alpha;
         }
+        falpha = alpha;
 
         cs = cspace;
 
@@ -177,35 +175,18 @@
     }
 
     public Color(int r, int g, int b, int a) {
-        if((r & 0xFF) != r ||
-                (g & 0xFF) != g ||
-                (b & 0xFF) != b ||
-                (a & 0xFF) != a) {
-            throw new IllegalArgumentException(
-                    "Color parameter outside of expected range.");
-        } else {
-            value =
-                    b         |
-                    (g << 8)  |
-                    (r << 16) |
-                    (a << 24);
+        if ((r & 0xFF) != r || (g & 0xFF) != g || (b & 0xFF) != b || (a & 0xFF) != a) {
+            throw new IllegalArgumentException("Color parameter outside of expected range.");
         }
+        value = b | (g << 8) | (r << 16) | (a << 24);
     }
 
     public Color(int r, int g, int b) {
-        if((r & 0xFF) != r ||
-                (g & 0xFF) != g ||
-                (b & 0xFF) != b )
-        {
-            throw new IllegalArgumentException(
-                    "Color parameter outside of expected range.");
-        } else {
-            value =
-                    b         |
-                    (g << 8)  |
-                    (r << 16) |
-                    0xFF000000; // 0xFF for alpha channel
+        if ((r & 0xFF) != r || (g & 0xFF) != g || (b & 0xFF) != b) {
+            throw new IllegalArgumentException("Color parameter outside of expected range.");
         }
+        // 0xFF for alpha channel
+        value = b | (g << 8) | (r << 16) | 0xFF000000;
     }
 
     public Color(int rgb) {
@@ -238,12 +219,12 @@
     ) {
         if(currentPaintContext != null) {
             return currentPaintContext;
-        } else {
-            currentPaintContext = new Color.ColorPaintContext(value);
         }
+        currentPaintContext = new Color.ColorPaintContext(value);
         return currentPaintContext;
     }
 
+    @Override
     public String toString() {
         /*
            The format of the string is based on 1.5 release behavior which
@@ -260,6 +241,7 @@
                 "]";
     }
 
+    @Override
     public boolean equals(Object obj) {
         if(obj instanceof Color) {
             return ((Color)obj).value == this.value;
@@ -269,8 +251,9 @@
 
     public float[] getComponents(ColorSpace colorSpace, float[] components) {
         int nComps = colorSpace.getNumComponents();
-        if(components == null)
+        if(components == null) {
             components = new float[nComps+1];
+        }
 
         getColorComponents(colorSpace, components);
 
@@ -287,8 +270,9 @@
         float[] cieXYZComponents = getColorSpace().toCIEXYZ(getColorComponents(null));
         float[] csComponents = colorSpace.fromCIEXYZ(cieXYZComponents);
 
-        if(components == null)
+        if(components == null) {
             return csComponents;
+        }
 
         for(int i=0; i<csComponents.length; i++) {
             components[i] = csComponents[i];
@@ -298,8 +282,9 @@
     }
 
     public ColorSpace getColorSpace() {
-        if (cs == null)
+        if (cs == null) {
             cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
+        }
 
         return cs;
     }
@@ -317,26 +302,27 @@
         int b = getBlue();
         int g = getGreen();
 
-        if(r == 0 && b == 0 && g == 0)
+        if(r == 0 && b == 0 && g == 0) {
             return new Color(MIN_SCALABLE, MIN_SCALABLE, MIN_SCALABLE);
+        }
 
-        if(r < MIN_SCALABLE && r != 0)
+        if(r < MIN_SCALABLE && r != 0) {
             r = MIN_SCALABLE;
-        else {
+        } else {
             r = (int) (r/SCALE_FACTOR);
             r = (r > 255) ? 255 : r;
         }
 
-        if(b < MIN_SCALABLE && b != 0)
+        if(b < MIN_SCALABLE && b != 0) {
             b = MIN_SCALABLE;
-        else {
+        } else {
             b = (int) (b/SCALE_FACTOR);
             b = (b > 255) ? 255 : b;
         }
 
-        if(g < MIN_SCALABLE && g != 0)
+        if(g < MIN_SCALABLE && g != 0) {
             g = MIN_SCALABLE;
-        else {
+        } else {
             g = (int) (g/SCALE_FACTOR);
             g = (g > 255) ? 255 : g;
         }
@@ -385,8 +371,9 @@
 
         int nColorComps = fvalue.length;
 
-        if(components == null)
+        if(components == null) {
             components = new float[nColorComps+1];
+        }
 
         getColorComponents(components);
 
@@ -400,8 +387,9 @@
             return getRGBColorComponents(components);
         }
 
-        if(components == null)
+        if(components == null) {
             components = new float[fvalue.length];
+        }
 
         for(int i=0; i<fvalue.length; i++) {
             components[i] = fvalue[i];
@@ -410,6 +398,7 @@
         return components;
     }
 
+    @Override
     public int hashCode() {
         return value;
     }
@@ -485,8 +474,9 @@
     }
 
     public static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals) {
-        if(hsbvals == null)
+        if(hsbvals == null) {
             hsbvals = new float[3];
+        }
 
         int V = Math.max(b, Math.max(r, g));
         int temp = Math.min(b, Math.min(r, g));
@@ -495,25 +485,27 @@
 
         B = V/255.f;
 
-        if(V == temp)
+        if(V == temp) {
             H = S = 0;
-        else {
+        } else {
             S = (V - temp)/((float)V);
 
             float Cr = (V - r) / (float)(V - temp);
             float Cg = (V - g) / (float)(V - temp);
             float Cb = (V - b) / (float)(V - temp);
 
-            if (r == V)
+            if (r == V) {
                 H = Cb - Cg;
-            else if (g == V)
+            } else if (g == V) {
                 H = 2 + Cr - Cb;
-            else
+            } else {
                 H = 4 + Cg - Cr;
+            }
 
             H /= 6.f;
-            if(H < 0)
+            if(H < 0) {
                 H++;
+            }
         }
 
         hsbvals[0] = H;
@@ -526,9 +518,9 @@
     public static int HSBtoRGB(float hue, float saturation, float brightness) {
         float fr, fg, fb;
 
-        if(saturation == 0)
+        if(saturation == 0) {
             fr = fg = fb = brightness;
-        else {
+        } else {
             float H = (hue - (float)Math.floor(hue)) * 6;
             int I = (int) Math.floor(H);
             float F = H - I;



Mime
View raw message