harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r454042 [1/6] - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common: java/awt/ org/apache/harmony/awt/
Date Sat, 07 Oct 2006 23:10:24 GMT
Author: ndbeyer
Date: Sat Oct  7 16:10:23 2006
New Revision: 454042

URL: http://svn.apache.org/viewvc?view=rev&rev=454042
Log:
Cleanup compiler warnings, format code.

Modified:
    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/AWTListenerList.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/Checkbox.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/Component.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/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/GradientPaint.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/GridBagLayout.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/KeyboardFocusManager.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/Menu.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/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/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/main/java/common/org/apache/harmony/awt/ListenerList.java

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=454042&r1=454041&r2=454042
==============================================================================
--- 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 Oct  7 16:10:23 2006
@@ -14,30 +14,53 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Michael Danilov
- * @version $Revision$
- */
-package java.awt;
 
-import java.awt.event.*;
+package java.awt;
 
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+import java.awt.event.ContainerEvent;
+import java.awt.event.ContainerListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.HierarchyBoundsListener;
+import java.awt.event.HierarchyEvent;
+import java.awt.event.HierarchyListener;
+import java.awt.event.InputMethodEvent;
+import java.awt.event.InputMethodListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
+import java.awt.event.TextEvent;
+import java.awt.event.TextListener;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowFocusListener;
+import java.awt.event.WindowListener;
+import java.awt.event.WindowStateListener;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
-
+import java.lang.reflect.Array;
 import java.util.EventListener;
 import java.util.LinkedList;
-import java.lang.reflect.Array;
 
-public class AWTEventMulticaster implements
-        ComponentListener, ContainerListener, FocusListener, KeyListener,
-        MouseListener, MouseMotionListener, WindowListener, WindowFocusListener,
-        WindowStateListener, ActionListener, ItemListener, AdjustmentListener,
-        TextListener, InputMethodListener, HierarchyListener, HierarchyBoundsListener,
-        MouseWheelListener
-{
+public class AWTEventMulticaster implements ComponentListener, ContainerListener,
+        FocusListener, KeyListener, MouseListener, MouseMotionListener, WindowListener,
+        WindowFocusListener, WindowStateListener, ActionListener, ItemListener,
+        AdjustmentListener, TextListener, InputMethodListener, HierarchyListener,
+        HierarchyBoundsListener, MouseWheelListener {
 
     protected final EventListener a;
+
     protected final EventListener b;
 
     protected static EventListener addInternal(EventListener a, EventListener b) {
@@ -61,22 +84,24 @@
     }
 
     protected static void save(ObjectOutputStream s, String k, EventListener l)
-            throws IOException
-    {
+            throws IOException {
         s.writeChars(k);
         s.writeObject(l);
     }
 
-    public static <T extends EventListener> T[] getListeners(EventListener l, Class<T> listenerType)
-            throws ClassCastException {
+    @SuppressWarnings("unchecked")
+    public static <T extends EventListener> T[] getListeners(EventListener l,
+            Class<T> listenerType) throws ClassCastException {
         if (l == null) {
-            return (T[]) java.lang.reflect.Array.newInstance(listenerType, 0);
+            return (T[]) Array.newInstance(listenerType, 0);
         }
         return addListeners(l, listenerType, new LinkedList<T>()).toArray(
-                (T[]) java.lang.reflect.Array.newInstance(listenerType, 0));
+                (T[]) Array.newInstance(listenerType, 0));
     }
 
-    private static <T extends EventListener> LinkedList<T> addListeners(EventListener l, Class<T> listenerType, LinkedList<T> list) {
+    @SuppressWarnings("unchecked")
+    private static <T extends EventListener> LinkedList<T> addListeners(EventListener l,
+            Class<T> listenerType, LinkedList<T> list) {
         if (l instanceof AWTEventMulticaster) {
             AWTEventMulticaster ml = (AWTEventMulticaster) l;
 
@@ -84,7 +109,7 @@
             addListeners(ml.b, listenerType, list);
         } else {
             if (l.getClass().isAssignableFrom(listenerType)) {
-                list.add((T)l);
+                list.add((T) l);
             }
         }
 
@@ -116,8 +141,7 @@
     }
 
     public static HierarchyBoundsListener add(HierarchyBoundsListener a,
-            HierarchyBoundsListener b)
-    {
+            HierarchyBoundsListener b) {
         return (HierarchyBoundsListener) addInternal(a, b);
     }
 
@@ -153,7 +177,6 @@
         return (KeyListener) addInternal(a, b);
     }
 
-
     public static MouseListener add(MouseListener a, MouseListener b) {
         return (MouseListener) addInternal(a, b);
     }
@@ -162,7 +185,6 @@
         return (AdjustmentListener) addInternal(a, b);
     }
 
-
     public static MouseListener remove(MouseListener l, MouseListener oldl) {
         return (MouseListener) removeInternal(l, oldl);
     }
@@ -192,8 +214,7 @@
     }
 
     public static HierarchyBoundsListener remove(HierarchyBoundsListener l,
-            HierarchyBoundsListener oldl)
-    {
+            HierarchyBoundsListener oldl) {
         return (HierarchyBoundsListener) removeInternal(l, oldl);
     }
 
@@ -597,5 +618,4 @@
             ((WindowStateListener) b).windowStateChanged(e);
         }
     }
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTListenerList.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTListenerList.java?view=diff&rev=454042&r1=454041&r2=454042
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTListenerList.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/AWTListenerList.java Sat Oct  7 16:10:23 2006
@@ -25,6 +25,11 @@
     private static final long serialVersionUID = -2622077171532840953L;
 
     private final Component owner;
+    
+    AWTListenerList() {
+        super();
+        this.owner = null;
+    }
 
     AWTListenerList(Component owner) {
         super();

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=454042&r1=454041&r2=454042
==============================================================================
--- 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 Oct  7 16:10:23 2006
@@ -14,33 +14,32 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Michael Danilov
- * @version $Revision$
- */
+
 package java.awt;
 
-import java.awt.event.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.util.EventListener;
-import java.util.Iterator;
-
-import javax.accessibility.*;
-
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleValue;
 import org.apache.harmony.awt.ButtonStateController;
 import org.apache.harmony.awt.FieldsAccessor;
 import org.apache.harmony.awt.state.ButtonState;
 
-
 public class Button extends Component implements Accessible {
     private static final long serialVersionUID = -8774683716313001058L;
 
-    protected class AccessibleAWTButton extends AccessibleAWTComponent implements AccessibleAction, AccessibleValue {
+    protected class AccessibleAWTButton extends AccessibleAWTComponent implements
+            AccessibleAction, AccessibleValue {
         private static final long serialVersionUID = -5932203980244017102L;
 
         protected AccessibleAWTButton() {
-
+            super();
         }
 
         public int getAccessibleActionCount() {
@@ -63,7 +62,7 @@
         }
 
         public Number getCurrentAccessibleValue() {
-            return new Integer(0);
+            return Integer.valueOf(0);
         }
 
         public boolean setCurrentAccessibleValue(Number n) {
@@ -71,11 +70,11 @@
         }
 
         public Number getMinimumAccessibleValue() {
-            return new Integer(0);
+            return Integer.valueOf(0);
         }
 
         public Number getMaximumAccessibleValue() {
-            return new Integer(0);
+            return Integer.valueOf(0);
         }
 
         @Override
@@ -97,10 +96,12 @@
         public AccessibleValue getAccessibleValue() {
             return this;
         }
-
     }
 
-    class State extends Component.ComponentState implements ButtonState {
+    private class State extends Component.ComponentState implements ButtonState {
+        State() {
+            super();
+        }
 
         public String getText() {
             return label;
@@ -126,12 +127,16 @@
     }
 
     private String actionCommand;
+
     private String label;
+
     private final Dimension labelSize;
+
     private final transient ButtonStateController stateController;
-    private final AWTListenerList actionListeners;
 
-    final transient State state = new State();
+    private final AWTListenerList<ActionListener> actionListeners;
+
+    private final transient State state = new State();
 
     public Button(String label) throws HeadlessException {
         toolkit.lockAWT();
@@ -139,9 +144,8 @@
             this.label = label;
             labelSize = new Dimension();
             actionCommand = null;
-            actionListeners = new AWTListenerList(this);
+            actionListeners = new AWTListenerList<ActionListener>(this);
             stateController = createStateController();
-
             addAWTMouseListener(stateController);
             addAWTKeyListener(stateController);
             addAWTFocusListener(stateController);
@@ -226,6 +230,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
         if (ActionListener.class.isAssignableFrom(listenerType)) {
@@ -240,11 +245,10 @@
 
     public void removeActionListener(ActionListener l) {
         actionListeners.removeUserListener(l);
-
     }
 
     public ActionListener[] getActionListeners() {
-        return (ActionListener[]) actionListeners.getUserListeners(new ActionListener[0]);
+        return actionListeners.getUserListeners(new ActionListener[0]);
     }
 
     @Override
@@ -257,13 +261,11 @@
     }
 
     protected void processActionEvent(ActionEvent e) {
-        for (Iterator i = actionListeners.getUserIterator(); i.hasNext();) {
-            ActionListener listener = (ActionListener) i.next();
-
+        for (ActionListener listener : actionListeners.getUserListeners()) {
             switch (e.getID()) {
-            case ActionEvent.ACTION_PERFORMED:
-                listener.actionPerformed(e);
-                break;
+                case ActionEvent.ACTION_PERFORMED:
+                    listener.actionPerformed(e);
+                    break;
             }
         }
     }
@@ -272,8 +274,8 @@
     protected String paramString() {
         toolkit.lockAWT();
         try {
-            return (super.paramString() + ",label=" + label + "," +
-                    (stateController.isPressed() ? "pressed" : "unpressed"));
+            return (super.paramString() + ",label=" + label + "," + (stateController
+                    .isPressed() ? "pressed" : "unpressed"));
         } finally {
             toolkit.unlockAWT();
         }
@@ -304,8 +306,8 @@
     }
 
     void generateEvent(long timestamp, int modifiers) {
-        postEvent(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
-                getActionCommand(), timestamp, modifiers));
+        postEvent(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, getActionCommand(),
+                timestamp, modifiers));
     }
 
     @Override
@@ -345,19 +347,17 @@
     }
 
     ButtonStateController createStateController() {
-
         return new ButtonStateController(this) {
             @Override
             protected void fireEvent() {
                 generateEvent(getWhen(), getMod());
-            }};
+            }
+        };
     }
 
-    private void readObject(ObjectInputStream stream)
-            throws IOException, ClassNotFoundException {
-
+    private void readObject(ObjectInputStream stream) throws IOException,
+            ClassNotFoundException {
         stream.defaultReadObject();
-
         FieldsAccessor accessor = new FieldsAccessor(Button.class, this);
         accessor.set("stateController", createStateController());
         accessor.set("state", new State());

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=454042&r1=454041&r2=454042
==============================================================================
--- 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 Oct  7 16:10:23 2006
@@ -14,10 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Dmitry A. Durnev
- * @version $Revision$
- */
+
 package java.awt;
 
 import java.awt.event.ItemEvent;
@@ -25,8 +22,6 @@
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.util.EventListener;
-import java.util.Iterator;
-
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
 import javax.accessibility.AccessibleContext;
@@ -34,21 +29,19 @@
 import javax.accessibility.AccessibleState;
 import javax.accessibility.AccessibleStateSet;
 import javax.accessibility.AccessibleValue;
-
 import org.apache.harmony.awt.ButtonStateController;
 import org.apache.harmony.awt.FieldsAccessor;
 import org.apache.harmony.awt.state.CheckboxState;
 
-
 public class Checkbox extends Component implements ItemSelectable, Accessible {
     private static final long serialVersionUID = 7270714317450821763L;
 
-    protected class AccessibleAWTCheckbox
-            extends Component.AccessibleAWTComponent
-            implements ItemListener, AccessibleAction, AccessibleValue {
+    protected class AccessibleAWTCheckbox extends Component.AccessibleAWTComponent implements
+            ItemListener, AccessibleAction, AccessibleValue {
         private static final long serialVersionUID = 7881579233144754107L;
 
         public AccessibleAWTCheckbox() {
+            super();
             // define default constructor explicitly just to make it public
             // add listener to be able to fire property changes:
             addItemListener(this);
@@ -84,16 +77,14 @@
             AccessibleState oldValue = null;
             AccessibleState newValue = null;
             switch (e.getStateChange()) {
-            case ItemEvent.SELECTED:
-                newValue = checkedState;
-                break;
-            case ItemEvent.DESELECTED:
-                oldValue = checkedState;
-                break;
+                case ItemEvent.SELECTED:
+                    newValue = checkedState;
+                    break;
+                case ItemEvent.DESELECTED:
+                    oldValue = checkedState;
+                    break;
             }
-            firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
-                               oldValue, newValue);
-
+            firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, oldValue, newValue);
         }
 
         public int getAccessibleActionCount() {
@@ -123,12 +114,14 @@
         public boolean setCurrentAccessibleValue(Number arg0) {
             return false;
         }
-
     }
 
-    final class State extends Component.ComponentState implements CheckboxState {
+    private final class State extends Component.ComponentState implements CheckboxState {
+        private final Dimension textSize = new Dimension();
 
-        final Dimension textSize = new Dimension();
+        State() {
+            super();
+        }
 
         public boolean isChecked() {
             return checked;
@@ -161,14 +154,18 @@
         }
     }
 
+    private final AWTListenerList<ItemListener> itemListeners = new AWTListenerList<ItemListener>(
+            this);
+
+    private String label;
 
-    private final AWTListenerList itemListeners = new AWTListenerList(this);
-    private String label = null;
-    private CheckboxGroup group = null;
-    boolean checked = false;
-    final transient State state = new State();
-    final transient ButtonStateController stateController;
+    private CheckboxGroup group;
 
+    private boolean checked;
+
+    private final transient State state = new State();
+
+    private final transient ButtonStateController stateController;
 
     public Checkbox() throws HeadlessException {
         this(new String(), null, false);
@@ -186,7 +183,6 @@
             this.group = group;
             setState(state);
             stateController = createStateController();
-
             addAWTMouseListener(stateController);
             addAWTKeyListener(stateController);
             addAWTFocusListener(stateController);
@@ -195,13 +191,10 @@
         }
     }
 
-
     private void generateEvent() {
         setState(!getState());
         int stateChange = (checked ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
-        postEvent(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
-                                this, stateChange));
-
+        postEvent(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, this, stateChange));
     }
 
     public Checkbox(String label) throws HeadlessException {
@@ -222,8 +215,7 @@
         }
     }
 
-    public Checkbox(String label, boolean state, CheckboxGroup group)
-    throws HeadlessException {
+    public Checkbox(String label, boolean state, CheckboxGroup group) throws HeadlessException {
         this(label, group, state);
         toolkit.lockAWT();
         try {
@@ -232,8 +224,6 @@
         }
     }
 
-
-
     public boolean getState() {
         toolkit.lockAWT();
         try {
@@ -269,11 +259,9 @@
          * which can be revealed by the following code:
          * System.out.println(new Checkbox());
          */
-
         toolkit.lockAWT();
         try {
-            return super.paramString() +
-            ",label=" + label + ",state=" + checked;
+            return super.paramString() + ",label=" + label + ",state=" + checked;
         } finally {
             toolkit.unlockAWT();
         }
@@ -315,9 +303,7 @@
             CheckboxGroup oldGroup = this.group;
             this.group = group;
             if (checked) {
-                if ((oldGroup != null) &&
-                    (oldGroup.getSelectedCheckbox() == this)) {
-
+                if ((oldGroup != null) && (oldGroup.getSelectedCheckbox() == this)) {
                     oldGroup.setSelectedCheckbox(null);
                 }
                 if (group != null) {
@@ -369,6 +355,7 @@
         repaint();
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
         toolkit.lockAWT();
@@ -403,7 +390,7 @@
     public ItemListener[] getItemListeners() {
         toolkit.lockAWT();
         try {
-            return (ItemListener[]) itemListeners.getUserListeners(new ItemListener[0]);
+            return itemListeners.getUserListeners(new ItemListener[0]);
         } finally {
             toolkit.unlockAWT();
         }
@@ -413,8 +400,7 @@
     protected void processEvent(AWTEvent e) {
         toolkit.lockAWT();
         try {
-            if (toolkit.eventTypeLookup.getEventMask(e) ==
-                AWTEvent.ITEM_EVENT_MASK) {
+            if (toolkit.eventTypeLookup.getEventMask(e) == AWTEvent.ITEM_EVENT_MASK) {
                 processItemEvent((ItemEvent) e);
             } else {
                 super.processEvent(e);
@@ -427,13 +413,11 @@
     protected void processItemEvent(ItemEvent e) {
         toolkit.lockAWT();
         try {
-            for (Iterator i = itemListeners.getUserIterator(); i.hasNext();) {
-                ItemListener listener = (ItemListener) i.next();
-
+            for (ItemListener listener : itemListeners.getUserListeners()) {
                 switch (e.getID()) {
-                case ItemEvent.ITEM_STATE_CHANGED:
-                    listener.itemStateChanged(e);
-                    break;
+                    case ItemEvent.ITEM_STATE_CHANGED:
+                        listener.itemStateChanged(e);
+                        break;
                 }
             }
         } finally {
@@ -481,24 +465,21 @@
     }
 
     ButtonStateController createStateController() {
-
         return new ButtonStateController(this) {
             @Override
             protected void fireEvent() {
                 generateEvent();
-            }};
+            }
+        };
     }
 
-    private void readObject(ObjectInputStream stream)
-            throws IOException, ClassNotFoundException {
-
+    private void readObject(ObjectInputStream stream) throws IOException,
+            ClassNotFoundException {
         stream.defaultReadObject();
-
         FieldsAccessor accessor = new FieldsAccessor(Button.class, this);
         accessor.set("stateController", createStateController());
         accessor.set("state", new State());
     }
-
 
     @Override
     AccessibleContext createAccessibleContext() {

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=454042&r1=454041&r2=454042
==============================================================================
--- 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 Oct  7 16:10:23 2006
@@ -14,30 +14,32 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Michael Danilov
- * @version $Revision$
- */
+
 package java.awt;
 
-import java.awt.event.*;
-import java.util.*;
-import javax.accessibility.*;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.EventListener;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleValue;
 
 public class CheckboxMenuItem extends MenuItem implements ItemSelectable, Accessible {
     private static final long serialVersionUID = 6190621106981774043L;
 
-    private final AWTListenerList itemListeners = new AWTListenerList(null);
+    private final AWTListenerList<ItemListener> itemListeners = new AWTListenerList<ItemListener>();
 
     private boolean checked;
 
-    protected class AccessibleAWTCheckboxMenuItem extends AccessibleAWTMenuItem
-            implements AccessibleAction, AccessibleValue {
+    protected class AccessibleAWTCheckboxMenuItem extends AccessibleAWTMenuItem implements
+            AccessibleAction, AccessibleValue {
         private static final long serialVersionUID = -1122642964303476L;
 
         @Override
         public boolean doAccessibleAction(int i) {
-            return false; //do nothing
+            return false; // do nothing
         }
 
         @Override
@@ -84,24 +86,14 @@
         public boolean setCurrentAccessibleValue(Number n) {
             return false;
         }
-
     }
 
     public CheckboxMenuItem() throws HeadlessException {
-        toolkit.lockAWT();
-        try {
-        } finally {
-            toolkit.unlockAWT();
-        }
+        super();
     }
 
     public CheckboxMenuItem(String label) throws HeadlessException {
         this(label, false);
-        toolkit.lockAWT();
-        try {
-        } finally {
-            toolkit.unlockAWT();
-        }
     }
 
     public CheckboxMenuItem(String label, boolean state) throws HeadlessException {
@@ -145,13 +137,13 @@
 
     @Override
     public String paramString() {
-        /* The format of paramString is based on 1.5 release behavior 
-         * which can be revealed using the following code:
-         *
+        /*
+         * The format of paramString is based on 1.5 release behavior which can
+         * be revealed using the following code:
+         * 
          * CheckboxMenuItem obj = new CheckboxMenuItem("Label", true);
          * System.out.println(obj.toString());
          */
-
         toolkit.lockAWT();
         try {
             return super.paramString() + (checked ? ",checked" : "");
@@ -178,6 +170,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
         if (ItemListener.class.isAssignableFrom(listenerType)) {
@@ -195,7 +188,7 @@
     }
 
     public ItemListener[] getItemListeners() {
-        return (ItemListener[]) itemListeners.getUserListeners(new ItemListener[0]);
+        return itemListeners.getUserListeners(new ItemListener[0]);
     }
 
     @Override
@@ -208,13 +201,11 @@
     }
 
     protected void processItemEvent(ItemEvent e) {
-        for (Iterator i = itemListeners.getUserIterator(); i.hasNext();) {
-            ItemListener listener = (ItemListener) i.next();
-
+        for (ItemListener listener : itemListeners.getUserListeners()) {
             switch (e.getID()) {
-            case ItemEvent.ITEM_STATE_CHANGED:
-                listener.itemStateChanged(e);
-                break;
+                case ItemEvent.ITEM_STATE_CHANGED:
+                    listener.itemStateChanged(e);
+                    break;
             }
         }
     }
@@ -227,7 +218,6 @@
     @Override
     void itemSelected(long when, int modifiers) {
         checked = !checked;
-
         super.itemSelected(when, modifiers);
     }
 
@@ -236,5 +226,4 @@
         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=454042&r1=454041&r2=454042
==============================================================================
--- 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 Oct  7 16:10:23 2006
@@ -14,10 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Dmitry A. Durnev
- * @version $Revision$
- */
+
 package java.awt;
 
 import java.awt.event.FocusEvent;
@@ -28,9 +25,10 @@
 import java.awt.event.MouseWheelEvent;
 import java.awt.event.MouseWheelListener;
 import java.awt.font.FontRenderContext;
+import java.util.ArrayList;
 import java.util.EventListener;
 import java.util.Iterator;
-import java.util.ArrayList;
+
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
 import javax.accessibility.AccessibleContext;
@@ -40,29 +38,28 @@
 import org.apache.harmony.awt.ChoiceStyle;
 import org.apache.harmony.awt.state.ChoiceState;
 
-
 public class Choice extends Component implements ItemSelectable, Accessible {
     private static final long serialVersionUID = -4075310674757313071L;
 
-    private final static int BORDER_SIZE = 2;
-    final static Insets INSETS = new Insets(BORDER_SIZE, BORDER_SIZE,
-                                            BORDER_SIZE, BORDER_SIZE);
-
-    private final AWTListenerList itemListeners = new AWTListenerList(this);
+    private static final int BORDER_SIZE = 2;
 
-    private final ArrayList<String> items = new ArrayList<String>();
+    static final Insets INSETS = new Insets(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE);
 
+    final ChoiceStyle popupStyle;
+    
     int selectedIndex = -1;
 
+    private final AWTListenerList<ItemListener> itemListeners = new AWTListenerList<ItemListener>(
+            this);
+
+    private final java.util.List<String> items = new ArrayList<String>();
+
     private final State state;
 
     private final ChoiceStateController stateController;
 
-    final ChoiceStyle popupStyle;
-
-    protected class AccessibleAWTChoice
-            extends Component.AccessibleAWTComponent
-            implements AccessibleAction {
+    protected class AccessibleAWTChoice extends Component.AccessibleAWTComponent implements
+            AccessibleAction {
         private static final long serialVersionUID = 7175603582428509322L;
 
         public AccessibleAWTChoice() {
@@ -73,10 +70,12 @@
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.COMBO_BOX;
         }
+
         @Override
         public AccessibleAction getAccessibleAction() {
             return this;
         }
+
         public int getAccessibleActionCount() {
             return 0;
         }
@@ -91,11 +90,10 @@
 
     }
 
-
-    class State extends Component.ComponentState
-            implements ChoiceState {
+    class State extends Component.ComponentState implements ChoiceState {
 
         final Dimension textSize = new Dimension();
+
         public boolean isPressed() {
             return stateController.isPressed();
         }
@@ -122,8 +120,7 @@
 
     }
 
-    class ChoiceStateController extends ButtonStateController
-    implements MouseWheelListener {
+    class ChoiceStateController extends ButtonStateController implements MouseWheelListener {
 
         /**
          * popup window containing list of items
@@ -151,39 +148,40 @@
             int blockSize = ChoicePopupBox.PAGE_SIZE - 1;
             int count = getItemCount();
             switch (e.getKeyCode()) {
-            case KeyEvent.VK_UP:
-                if (alt) {
-                    popup();
+                case KeyEvent.VK_UP:
+                    if (alt) {
+                        popup();
+                        break;
+                    }
+                case KeyEvent.VK_LEFT:
+                    changeSelection(-1);
+                    break;
+                case KeyEvent.VK_DOWN:
+                    if (alt) {
+                        popup();
+                        break;
+                    }
+                case KeyEvent.VK_RIGHT:
+                    changeSelection(1);
+                    break;
+                case KeyEvent.VK_PAGE_UP:
+                    changeSelection(-blockSize);
                     break;
-                }
-            case KeyEvent.VK_LEFT:
-                changeSelection(-1);
-                break;
-            case KeyEvent.VK_DOWN:
-                if (alt) {
-                    popup();
+                case KeyEvent.VK_PAGE_DOWN:
+                    changeSelection(blockSize);
+                    break;
+                case KeyEvent.VK_HOME:
+                    changeSelection(-getSelectedIndex());
+                    break;
+                case KeyEvent.VK_END:
+                    changeSelection(count - getSelectedIndex());
                     break;
-                }
-            case KeyEvent.VK_RIGHT:
-                changeSelection(1);
-                break;
-            case KeyEvent.VK_PAGE_UP:
-                changeSelection(-blockSize);
-                break;
-            case KeyEvent.VK_PAGE_DOWN:
-                changeSelection(blockSize);
-                break;
-            case KeyEvent.VK_HOME:
-                changeSelection(-getSelectedIndex());
-                break;
-            case KeyEvent.VK_END:
-                changeSelection(count  - getSelectedIndex());
-                break;
             }
         }
 
         /**
          * Moves selection up(incr &lt; 0) or down(incr &gt; 0)
+         * 
          * @param incr distance from the current item in items
          */
         void changeSelection(int incr) {
@@ -209,8 +207,7 @@
         }
 
         /**
-         * Shows popup list if it's not visible,
-         * hides otherwise        
+         * Shows popup list if it's not visible, hides otherwise
          */
         private void popup() {
             if (!popup.isVisible()) {
@@ -224,12 +221,12 @@
         public void mousePressed(MouseEvent me) {
             super.mousePressed(me);
             // TODO: show/hide popup here
-//            if (me.getButton() != MouseEvent.BUTTON1) {
-//                return;
-//            }
-//            if (me.isPopupTrigger()) {
-//                popup();
-//            }
+            // if (me.getButton() != MouseEvent.BUTTON1) {
+            // return;
+            // }
+            // if (me.isPopupTrigger()) {
+            // popup();
+            // }
         }
 
         public void mouseWheelMoved(MouseWheelEvent e) {
@@ -240,10 +237,12 @@
 
     /**
      * Creates customized choice
-     * @param choiceStyle style of custom choice:
-     * defines custom list popup window location and size 
+     * 
+     * @param choiceStyle style of custom choice: defines custom list popup
+     *        window location and size
      */
     Choice(ChoiceStyle choiceStyle) {
+        super();
         state = new State();
         popupStyle = choiceStyle;
         stateController = new ChoiceStateController();
@@ -257,8 +256,7 @@
     public Choice() throws HeadlessException {
         this(new ChoiceStyle() {
 
-            public int getPopupX(int x, int width, int choiceWidth,
-                                 int screenWidth) {
+            public int getPopupX(int x, int width, int choiceWidth, int screenWidth) {
                 return x;
             }
 
@@ -382,9 +380,9 @@
 
     @Override
     protected String paramString() {
-        /* The format is based on 1.5 release behavior 
-         * which can be revealed by the following code:
-         * System.out.println(new Choice());
+        /*
+         * The format is based on 1.5 release behavior which can be revealed by
+         * the following code: System.out.println(new Choice());
          */
 
         toolkit.lockAWT();
@@ -399,7 +397,7 @@
         toolkit.lockAWT();
         try {
             if (items.size() > 0) {
-                return new Object[] {items.get(selectedIndex)};
+                return new Object[] { items.get(selectedIndex) };
             }
             return null;
         } finally {
@@ -472,8 +470,8 @@
         toolkit.lockAWT();
         try {
             if (pos >= items.size() || pos < 0) {
-                throw new IllegalArgumentException
-                    ("specified position is greater than the number of items");
+                throw new IllegalArgumentException(
+                        "specified position is greater than the number of items");
             }
             selectedIndex = pos;
             repaint();
@@ -494,6 +492,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
         if (ItemListener.class.isAssignableFrom(listenerType)) {
@@ -511,7 +510,7 @@
     }
 
     public ItemListener[] getItemListeners() {
-        return (ItemListener[]) itemListeners.getUserListeners(new ItemListener[0]);
+        return itemListeners.getUserListeners(new ItemListener[0]);
     }
 
     @Override
@@ -528,9 +527,9 @@
             ItemListener listener = (ItemListener) i.next();
 
             switch (e.getID()) {
-            case ItemEvent.ITEM_STATE_CHANGED:
-                listener.itemStateChanged(e);
-                break;
+                case ItemEvent.ITEM_STATE_CHANGED:
+                    listener.itemStateChanged(e);
+                    break;
             }
         }
     }
@@ -546,8 +545,7 @@
     }
 
     /**
-     * Widest list item must fit into Choice minimum
-     * size
+     * Widest list item must fit into Choice minimum size
      */
     @Override
     Dimension getDefaultMinimumSize() {
@@ -562,13 +560,11 @@
         minSize.height = fm.getHeight() + vGap + 1;
         minSize.width = hGap + 16; // TODO: use arrow button size
 
-        FontRenderContext frc =
-            ((Graphics2D)getGraphics()).getFontRenderContext();
-        int maxItemWidth = 5; //TODO: take width of some char
+        FontRenderContext frc = ((Graphics2D) getGraphics()).getFontRenderContext();
+        int maxItemWidth = 5; // TODO: take width of some char
         for (int i = 0; i < items.size(); i++) {
             String item = getItem(i);
-            int itemWidth =
-                font.getStringBounds(item, frc).getBounds().width;
+            int itemWidth = font.getStringBounds(item, frc).getBounds().width;
             if (itemWidth > maxItemWidth) {
                 maxItemWidth = itemWidth;
             }
@@ -577,7 +573,6 @@
         return minSize;
     }
 
-
     @Override
     boolean isPrepainter() {
         return true;
@@ -588,13 +583,13 @@
         toolkit.theme.drawChoice(g, state);
     }
 
-
     @Override
     void setFontImpl(Font f) {
         super.setFontImpl(f);
         setSize(getWidth(), getDefaultMinimumSize().height);
     }
 
+    @SuppressWarnings("deprecation")
     int getItemHeight() {
         FontMetrics fm = toolkit.getFontMetrics(getFont());
         int itemHeight = fm.getHeight() + 2;
@@ -602,13 +597,13 @@
     }
 
     void fireItemEvent() {
-        postEvent(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
-                                getSelectedItem(), ItemEvent.SELECTED));
+        postEvent(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, getSelectedItem(),
+                ItemEvent.SELECTED));
     }
 
     /**
-     * This method is necessary because <code> public select(int) </code>
-     * should not fire any events
+     * This method is necessary because <code> public select(int) </code> should
+     * not fire any events
      */
     void selectAndFire(int idx) {
         if (idx == getSelectedIndex()) {
@@ -620,8 +615,9 @@
 
     /**
      * Gets the nearest valid index
+     * 
      * @param idx any integer value
-     * @return valid item index nearest to idx 
+     * @return valid item index nearest to idx
      */
     int getValidIndex(int idx) {
         return Math.min(getItemCount() - 1, Math.max(0, idx));

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=454042&r1=454041&r2=454042
==============================================================================
--- 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 Oct  7 16:10:23 2006
@@ -14,17 +14,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Dmitry A. Durnev
- * @version $Revision$
- */
+
 package java.awt;
 
 import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseWheelEvent;
-
 import org.apache.harmony.awt.ChoiceStyle;
 import org.apache.harmony.awt.PeriodicTimer;
 import org.apache.harmony.awt.ScrollStateController;
@@ -33,56 +29,64 @@
 import org.apache.harmony.awt.gl.MultiRectArea;
 import org.apache.harmony.awt.state.ListState;
 
-
 /**
  * Helper class: popup window containing list of
  * Choice items, implements popup and scrolling list behavior
  * of Choice component
  */
 class ChoicePopupBox extends PopupBox {
-
     private final Choice choice;
-    
+
     /**
      * how many items to scroll on PgUp/PgDn
      */
     final static int PAGE_SIZE = 8;
-    
+
     /**
      * how many ticks to skip when scroll speed is minimum
      */
     final static int MAX_SKIP = 12;
-    
+
     int selectedItem;
+
     int focusedItem;
-    
+
     /**
      * fields for dragging/scrolling behavior implementation
      */
     private int scrollLocation;
+
     transient ScrollPaneAdjustable vAdj;
+
     Scrollable scrollable;
+
     ScrollStateController scrollController;
+
     ScrollbarStateController scrollbarController;
+
     boolean scroll;
+
     private boolean scrollDragged;
 
     /**
      * fields for scrolling animation
      */
-    private PeriodicTimer dragScrollTimer;
+    private final PeriodicTimer dragScrollTimer;
+
     private int dragScrollSpeed;
+
     private Runnable dragScrollHandler;
+
     private int nSkip; // scroll every nSkip ticks
-    
+
     private final ChoiceListState listState;
+
     private final ChoiceStyle style;
 
     /**
      * List state implementation
      */
     class ChoiceListState extends Choice.ComponentState implements ListState {
-
         ChoiceListState() {
             choice.super();
         }
@@ -104,7 +108,6 @@
             return choice.getItemCount();
         }
 
-
         public boolean isSelected(int idx) {
             return (selectedItem == idx);
         }
@@ -122,12 +125,11 @@
             return ChoicePopupBox.this.getSize();
         }
     }
-    
+
     /**
      * Scrolling behavior implementation
      */
     class ChoiceScrollable implements Scrollable {
-
         public Adjustable getVAdjustable() {
             return vAdj;
         }
@@ -146,7 +148,6 @@
 
         public void setLocation(Point p) {
             scrollLocation = p.y;
-
         }
 
         public Component getComponent() {
@@ -154,8 +155,7 @@
         }
 
         public Dimension getSize() {
-            return new Dimension(getWidth(),
-                                 choice.getItemHeight() * choice.getItemCount());
+            return new Dimension(getWidth(), choice.getItemHeight() * choice.getItemCount());
         }
 
         public void doRepaint() {
@@ -170,10 +170,8 @@
             return 0;
         }
 
-        public void setAdjustableSizes(Adjustable adj, int vis, int min,
-                                       int max) {
+        public void setAdjustableSizes(Adjustable adj, int vis, int min, int max) {
             vAdj.setSizes(vis, min, max);
-
         }
 
         public int getAdjustableMode(Adjustable adj) {
@@ -195,7 +193,6 @@
         public void doRepaint(Rectangle r) {
             repaint(r);
         }
-
     }
 
     public ChoicePopupBox(Choice choice) {
@@ -204,6 +201,7 @@
         style = choice.popupStyle;
         vAdj = new ScrollPaneAdjustable(choice, Adjustable.VERTICAL) {
             private static final long serialVersionUID = 2280561825998835980L;
+
             @Override
             void repaintComponent(Rectangle r) {
                 if (isVisible()) {
@@ -217,8 +215,7 @@
         scrollbarController = vAdj.getStateController();
         vAdj.addAdjustmentListener(scrollController);
         nSkip = MAX_SKIP;
-        dragScrollTimer = new PeriodicTimer(25l,
-                                            getAsyncHandler(getDragScrollHandler()));
+        dragScrollTimer = new PeriodicTimer(25l, getAsyncHandler(getDragScrollHandler()));
     }
 
     public int getWidth() {
@@ -233,14 +230,14 @@
         if (dragScrollHandler == null) {
             dragScrollHandler = new Runnable() {
                 int n;
+
                 public void run() {
                     if (n++ % nSkip == 0) {
-                    int selItem = focusedItem + (dragScrollSpeed /
-                            Math.abs(dragScrollSpeed));
-                    selectItem(selItem, false);
-                    vAdj.setValue(vAdj.getValue() + dragScrollSpeed);
+                        int selItem = focusedItem
+                                + (dragScrollSpeed / Math.abs(dragScrollSpeed));
+                        selectItem(selItem, false);
+                        vAdj.setValue(vAdj.getValue() + dragScrollSpeed);
                     }
-
                 }
             };
         }
@@ -285,10 +282,9 @@
     Rectangle getItemBounds(int pos) {
         int itemHeight = choice.getItemHeight();
         Point p = new Point(0, pos * itemHeight);
-        Rectangle itemRect = new Rectangle(p, new Dimension(getWidth(),
-                                                            itemHeight));
+        Rectangle itemRect = new Rectangle(p, new Dimension(getWidth(), itemHeight));
         itemRect.translate(0, scrollLocation);
-        return  itemRect;
+        return itemRect;
     }
 
     /**
@@ -306,19 +302,14 @@
             count = PAGE_SIZE;
             scroll = true;
         }
-
         int height = count * itemHeight;
         Rectangle screenBounds = choice.getGraphicsConfiguration().getBounds();
         Point screenLoc = choice.getLocationOnScreen();
-        int x = style.getPopupX(screenLoc.x, itemWidth, choiceWidth,
-                                screenBounds.width);
+        int x = style.getPopupX(screenLoc.x, itemWidth, choiceWidth, screenBounds.width);
         int y = calcY(screenLoc.y, height, screenBounds.height);
-
         return new Rectangle(x, y, itemWidth, height);
     }
 
-
-
     /**
      * Places list popup window below or above Choice component
      * @param y Choice component screen y-coordinate
@@ -354,23 +345,20 @@
      * @return current popup window bounds
      */
     Rectangle getBounds() {
-        return new Rectangle(new Point(),
-                             getSize());
+        return new Rectangle(new Point(), getSize());
     }
 
-
     @Override
     void onKeyEvent(int eventId, int vKey, long when, int modifiers) {
         if (eventId == KeyEvent.KEY_PRESSED) {
             switch (vKey) {
-            case KeyEvent.VK_ESCAPE:
-                hide();
-                break;
-
-            case KeyEvent.VK_ENTER:
-                hide();
-                choice.selectAndFire(selectedItem);
-                break;
+                case KeyEvent.VK_ESCAPE:
+                    hide();
+                    break;
+                case KeyEvent.VK_ENTER:
+                    hide();
+                    choice.selectAndFire(selectedItem);
+                    break;
             }
         }
     }
@@ -408,21 +396,18 @@
             return;
         }
         int itemHeight = choice.getItemHeight();
-
         int dy = ((y < 0) ? -y : (y - h));
         nSkip = Math.max(1, MAX_SKIP - 5 * dy / itemHeight);
         dragScrollSpeed = itemHeight * (y / Math.abs(y));
         dragScrollTimer.start();
-
     }
 
     /**
      * Handles all mouse events on popup window
      */
     @Override
-    void onMouseEvent(int eventId, Point where, int mouseButton, long when,
-                      int modifiers, int wheelRotation) {
-
+    void onMouseEvent(int eventId, Point where, int mouseButton, long when, int modifiers,
+            int wheelRotation) {
         if (scroll && (eventId == MouseEvent.MOUSE_WHEEL)) {
             processMouseWheel(where, when, modifiers, wheelRotation);
             return;
@@ -435,65 +420,59 @@
         int y = where.y;
         int index = (y - scrollLocation) / choice.getItemHeight();
         switch (eventId) {
-        case MouseEvent.MOUSE_PRESSED:
-            break;
-        case MouseEvent.MOUSE_DRAGGED:
-            // scroll on mouse drag
-            if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
-                dragScroll(y);
-            }
-        case MouseEvent.MOUSE_MOVED:
-            if ((index < 0) || (index >= choice.getItemCount()) ||
-                (index == selectedItem)) {
-                return;
-            }
-            boolean select = getBounds().contains(where);
-            if ((y >= 0) && (y < getHeight())) {
-                selectItem(index, select); //hot track
-            }
-            break;
-        case MouseEvent.MOUSE_RELEASED:
-            if (button1) {
-                hide();
-                choice.selectAndFire(index);
-            }
-            break;
+            case MouseEvent.MOUSE_PRESSED:
+                break;
+            case MouseEvent.MOUSE_DRAGGED:
+                // scroll on mouse drag
+                if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
+                    dragScroll(y);
+                }
+            case MouseEvent.MOUSE_MOVED:
+                if ((index < 0) || (index >= choice.getItemCount()) || (index == selectedItem)) {
+                    return;
+                }
+                boolean select = getBounds().contains(where);
+                if ((y >= 0) && (y < getHeight())) {
+                    selectItem(index, select); //hot track
+                }
+                break;
+            case MouseEvent.MOUSE_RELEASED:
+                if (button1) {
+                    hide();
+                    choice.selectAndFire(index);
+                }
+                break;
         }
     }
-    
+
     /**
      * Mouse wheel event processing by vertical scrollbar
      */
-    private void processMouseWheel(Point where, long when,
-                                   int modifiers, int wheelRotation) {
-        MouseWheelEvent mwe = new MouseWheelEvent(choice, MouseEvent.MOUSE_WHEEL,
-                                                  when, modifiers, where.x,
-                                                  where.y, 0, false,
-                                                  MouseWheelEvent.WHEEL_UNIT_SCROLL,
-                                                  1, wheelRotation);
+    private void processMouseWheel(Point where, long when, int modifiers, int wheelRotation) {
+        MouseWheelEvent mwe = new MouseWheelEvent(choice, MouseEvent.MOUSE_WHEEL, when,
+                modifiers, where.x, where.y, 0, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, 1,
+                wheelRotation);
         scrollController.mouseWheelMoved(mwe);
     }
 
     /**
      * Mouse event processing by vertical scrollbar
      */
-    private void processMouseEvent(int id, Point where, int button,
-                                   long when, int modifiers) {
-        MouseEvent me = new MouseEvent(choice, id, when,
-                                       modifiers, where.x, where.y,
-                                       0, false, button);
+    private void processMouseEvent(int id, Point where, int button, long when, int modifiers) {
+        MouseEvent me = new MouseEvent(choice, id, when, modifiers, where.x, where.y, 0, false,
+                button);
         switch (id) {
-        case MouseEvent.MOUSE_PRESSED:
-            scrollDragged = true;
-            scrollbarController.mousePressed(me);
-            break;
-        case MouseEvent.MOUSE_RELEASED:
-            scrollDragged = false;
-            scrollbarController.mouseReleased(me);
-            break;
-        case MouseEvent.MOUSE_DRAGGED:
-            scrollbarController.mouseDragged(me);
-            break;
+            case MouseEvent.MOUSE_PRESSED:
+                scrollDragged = true;
+                scrollbarController.mousePressed(me);
+                break;
+            case MouseEvent.MOUSE_RELEASED:
+                scrollDragged = false;
+                scrollbarController.mouseReleased(me);
+                break;
+            case MouseEvent.MOUSE_DRAGGED:
+                scrollbarController.mouseDragged(me);
+                break;
         }
     }
 
@@ -546,7 +525,6 @@
         return true;
     }
 
-
     @Override
     void hide() {
         // stop timer before closing:
@@ -555,4 +533,4 @@
         }
         super.hide();
     }
-}
\ No newline at end of file
+}



Mime
View raw message