You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/11/24 03:41:16 UTC

svn commit: r478753 [1/3] - in /harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing: JComboBox.java JMenu.java JMenuBar.java JSpinner.java JTabbedPane.java JTree.java ProgressMonitor.java

Author: ndbeyer
Date: Thu Nov 23 18:41:15 2006
New Revision: 478753

URL: http://svn.apache.org/viewvc?view=rev&rev=478753
Log:
Cleanup
* use NotImplementedExceptions
* Add missing annotations
* Add serialVersionUID fields
* format code

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComboBox.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenu.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenuBar.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JSpinner.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTabbedPane.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ProgressMonitor.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComboBox.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComboBox.java?view=diff&rev=478753&r1=478752&r2=478753
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComboBox.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JComboBox.java Thu Nov 23 18:41:15 2006
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Anton Avtamonov
- * @version $Revision$
- */
-
 package javax.swing;
 
 import java.awt.ItemSelectable;
@@ -31,7 +26,6 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.util.Vector;
-
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
 import javax.accessibility.AccessibleContext;
@@ -45,72 +39,107 @@
 import javax.swing.event.PopupMenuEvent;
 import javax.swing.event.PopupMenuListener;
 import javax.swing.plaf.ComboBoxUI;
-
+import org.apache.harmony.luni.util.NotImplementedException;
 import org.apache.harmony.x.swing.StringConstants;
 
+/**
+ * <p>
+ * <i>JComboBox</i>
+ * </p>
+ * <h3>Implementation Notes:</h3>
+ * <ul>
+ * <li>The <code>serialVersionUID</code> fields are explicitly declared as a performance
+ * optimization, not as guarantee of serialization compatibility.</li>
+ * </ul>
+ */
+public class JComboBox extends JComponent implements ItemSelectable, ListDataListener,
+        ActionListener, Accessible {
+    private static final long serialVersionUID = 4884562788864849284L;
+
+    protected class AccessibleJComboBox extends AccessibleJComponent implements
+            AccessibleAction, AccessibleSelection {
+        private static final long serialVersionUID = 1L;
 
-public class JComboBox extends JComponent implements ItemSelectable, ListDataListener, ActionListener, Accessible {
-    protected class AccessibleJComboBox extends AccessibleJComponent implements AccessibleAction, AccessibleSelection {
         public AccessibleJComboBox() {
-
         }
+
+        @Override
         public int getAccessibleChildrenCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
-        public Accessible getAccessibleChild(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        @Override
+        public Accessible getAccessibleChild(int i) {
+            throw new NotImplementedException();
         }
+
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.COMBO_BOX;
         }
+
+        @Override
         public AccessibleStateSet getAccessibleStateSet() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
+        @Override
         public AccessibleAction getAccessibleAction() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
-        public String getAccessibleActionDescription(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public String getAccessibleActionDescription(int i) {
+            throw new NotImplementedException();
         }
+
         public int getAccessibleActionCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
-        public boolean doAccessibleAction(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public boolean doAccessibleAction(int i) {
+            throw new NotImplementedException();
         }
+
+        @Override
         public AccessibleSelection getAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
         public int getAccessibleSelectionCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
-        public Accessible getAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public Accessible getAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
-        public boolean isAccessibleChildSelected(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public boolean isAccessibleChildSelected(int i) {
+            throw new NotImplementedException();
         }
-        public void addAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void addAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
-        public void removeAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void removeAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
+
         public void clearAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
         public void selectAllAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
     }
 
     public static interface KeySelectionManager {
-        int selectionForKey(final char key, final ComboBoxModel model);
+        int selectionForKey(char key, ComboBoxModel model);
     }
 
-
     private class DefaultKeySelectionManager implements KeySelectionManager {
-        public int selectionForKey(final char keyChar, final ComboBoxModel model) {
+        public int selectionForKey(char keyChar, ComboBoxModel model) {
             int selectedIndex = getIndex(model.getSelectedItem(), model);
             for (int i = selectedIndex + 1; i < model.getSize(); i++) {
                 String item = model.getElementAt(i).toString();
@@ -118,92 +147,104 @@
                     return i;
                 }
             }
-
             for (int i = 0; i <= selectedIndex; i++) {
                 String item = model.getElementAt(i).toString();
                 if (itemStartsWith(item, keyChar)) {
                     return i;
                 }
             }
-
             return -1;
         }
 
-        private boolean itemStartsWith(final String item, final char keyChar) {
+        private boolean itemStartsWith(String item, char keyChar) {
             return Character.toUpperCase(keyChar) == Character.toUpperCase(item.charAt(0));
         }
     }
 
     private class ActionPropertyChangeListener implements PropertyChangeListener {
-        public void propertyChange(final PropertyChangeEvent event) {
-            Action action = (Action)event.getSource();
+        public void propertyChange(PropertyChangeEvent event) {
+            Action action = (Action) event.getSource();
             if (action != null) {
                 String propertyName = event.getPropertyName();
                 if (Action.SHORT_DESCRIPTION.equals(propertyName)) {
-                    setToolTipText((String)event.getNewValue());
+                    setToolTipText((String) event.getNewValue());
                 } else if (StringConstants.ENABLED_PROPERTY_CHANGED.equals(propertyName)) {
-                    setEnabled(((Boolean)event.getNewValue()).booleanValue());
+                    setEnabled(((Boolean) event.getNewValue()).booleanValue());
                 } else if (Action.ACTION_COMMAND_KEY.equals(propertyName)) {
-                    setActionCommand((String)action.getValue(Action.ACTION_COMMAND_KEY));
+                    setActionCommand((String) action.getValue(Action.ACTION_COMMAND_KEY));
                 }
             }
         }
     }
 
     private static final String UI_CLASS_ID = "ComboBoxUI";
+
     private static final String MAXIMUM_ROW_COUNT_PROPERTY_CHANGED = "maximumRowCount";
+
     private static final String PROTOTYPE_DISPLAY_VALUE_PROPERTY_CHANGED = "prototypeDisplayValue";
 
     protected String actionCommand = "comboBoxChanged";
+
     protected ComboBoxModel dataModel;
+
     protected ComboBoxEditor editor;
+
     protected boolean isEditable;
+
     protected KeySelectionManager keySelectionManager;
+
     protected boolean lightWeightPopupEnabled = true;
+
     protected int maximumRowCount = 8;
+
     protected ListCellRenderer renderer;
+
     protected Object selectedItemReminder;
 
     private Object prototypeDisplayValue;
+
     private Action action;
+
     private PropertyChangeListener actionPropertyChangeListener;
 
     public JComboBox() {
         this(new DefaultComboBoxModel());
     }
 
-    public JComboBox(final Object[] items) {
+    public JComboBox(Object[] items) {
         this(new DefaultComboBoxModel(items));
     }
-    public JComboBox(final Vector<?> items) {
+
+    public JComboBox(Vector<?> items) {
         this(new DefaultComboBoxModel(items));
     }
 
-    public JComboBox(final ComboBoxModel model) {
+    public JComboBox(ComboBoxModel model) {
         dataModel = model;
         dataModel.addListDataListener(this);
         installAncestorListener();
-
         updateUI();
     }
 
-    public void setUI(final ComboBoxUI ui) {
+    public void setUI(ComboBoxUI ui) {
         super.setUI(ui);
     }
 
+    @Override
     public void updateUI() {
-        setUI((ComboBoxUI)UIManager.getUI(this));
+        setUI((ComboBoxUI) UIManager.getUI(this));
     }
 
+    @Override
     public String getUIClassID() {
         return UI_CLASS_ID;
     }
 
     public ComboBoxUI getUI() {
-        return (ComboBoxUI)ui;
+        return (ComboBoxUI) ui;
     }
 
-    public void setModel(final ComboBoxModel model) {
+    public void setModel(ComboBoxModel model) {
         if (dataModel != model) {
             ComboBoxModel oldModel = dataModel;
             if (oldModel != null) {
@@ -211,7 +252,6 @@
             }
             dataModel = model;
             dataModel.addListDataListener(this);
-
             firePropertyChange(StringConstants.MODEL_PROPERTY_CHANGED, oldModel, model);
         }
     }
@@ -220,10 +260,11 @@
         return dataModel;
     }
 
-    public void setLightWeightPopupEnabled(final boolean isEnabled) {
+    public void setLightWeightPopupEnabled(boolean isEnabled) {
         if (lightWeightPopupEnabled != isEnabled) {
             lightWeightPopupEnabled = isEnabled;
-            firePropertyChange(StringConstants.LIGHTWEIGHT_POPUP_ENABLED_PROPERTY_CHANGED, !isEnabled, isEnabled);
+            firePropertyChange(StringConstants.LIGHTWEIGHT_POPUP_ENABLED_PROPERTY_CHANGED,
+                    !isEnabled, isEnabled);
         }
     }
 
@@ -231,10 +272,11 @@
         return lightWeightPopupEnabled;
     }
 
-    public void setEditable(final boolean isEditable) {
+    public void setEditable(boolean isEditable) {
         if (this.isEditable != isEditable) {
             this.isEditable = isEditable;
-            firePropertyChange(StringConstants.EDITABLE_PROPERTY_CHANGED, !isEditable, isEditable);
+            firePropertyChange(StringConstants.EDITABLE_PROPERTY_CHANGED, !isEditable,
+                    isEditable);
         }
     }
 
@@ -242,7 +284,7 @@
         return isEditable;
     }
 
-    public void setMaximumRowCount(final int count) {
+    public void setMaximumRowCount(int count) {
         LookAndFeel.markPropertyNotInstallable(this, "maximumRowCount");
         if (maximumRowCount != count) {
             int oldValue = maximumRowCount;
@@ -255,7 +297,7 @@
         return maximumRowCount;
     }
 
-    public void setRenderer(final ListCellRenderer renderer) {
+    public void setRenderer(ListCellRenderer renderer) {
         if (this.renderer != renderer) {
             ListCellRenderer oldValue = this.renderer;
             this.renderer = renderer;
@@ -267,13 +309,12 @@
         return renderer;
     }
 
-    public void setEditor(final ComboBoxEditor editor) {
+    public void setEditor(ComboBoxEditor editor) {
         if (this.editor != editor) {
             ComboBoxEditor oldValue = this.editor;
             if (oldValue != null) {
                 oldValue.removeActionListener(this);
             }
-
             this.editor = editor;
             if (this.editor != null) {
                 this.editor.addActionListener(this);
@@ -286,11 +327,11 @@
         return editor;
     }
 
-    public void setSelectedItem(final Object element) {
+    public void setSelectedItem(Object element) {
         selectedItemReminder = dataModel.getSelectedItem();
-
         if (isEditable || getIndex(element) != -1 || element == null) {
-            if (element != getSelectedItem() || element != null && !element.equals(getSelectedItem())) {
+            if (element != getSelectedItem() || element != null
+                    && !element.equals(getSelectedItem())) {
                 dataModel.setSelectedItem(element);
             } else if (isEditable && element != null && !element.equals(getEditor().getItem())) {
                 getEditor().setItem(element);
@@ -299,19 +340,17 @@
                 fireActionEvent();
             }
         }
-
-        
     }
 
     public Object getSelectedItem() {
         return dataModel.getSelectedItem();
     }
 
-    public void setSelectedIndex(final int index) {
+    public void setSelectedIndex(int index) {
         if (index < -1 || index >= dataModel.getSize()) {
-            throw new IllegalArgumentException("Selected index should in the range of available indices");
+            throw new IllegalArgumentException(
+                    "Selected index should in the range of available indices");
         }
-
         if (index == -1) {
             setSelectedItem(null);
         } else {
@@ -322,9 +361,8 @@
     public Object[] getSelectedObjects() {
         if (getSelectedItem() != null) {
             return new Object[] { getSelectedItem() };
-        } else {
-            return new Object[0];
         }
+        return new Object[0];
     }
 
     public int getSelectedIndex() {
@@ -335,46 +373,46 @@
         return prototypeDisplayValue;
     }
 
-    public void setPrototypeDisplayValue(final Object prototypeDisplayValue) {
+    public void setPrototypeDisplayValue(Object prototypeDisplayValue) {
         if (this.prototypeDisplayValue != prototypeDisplayValue) {
             Object oldValue = this.prototypeDisplayValue;
             this.prototypeDisplayValue = prototypeDisplayValue;
-
-            firePropertyChange(PROTOTYPE_DISPLAY_VALUE_PROPERTY_CHANGED, oldValue, prototypeDisplayValue);
+            firePropertyChange(PROTOTYPE_DISPLAY_VALUE_PROPERTY_CHANGED, oldValue,
+                    prototypeDisplayValue);
         }
     }
 
-    public void addItem(final Object element) {
+    public void addItem(Object element) {
         selectedItemReminder = getSelectedItem();
         if (dataModel instanceof MutableComboBoxModel) {
-            ((MutableComboBoxModel)dataModel).addElement(element);
+            ((MutableComboBoxModel) dataModel).addElement(element);
         } else {
             throw new RuntimeException("Cannot modify immutable data model");
         }
     }
 
-    public void insertItemAt(final Object element, final int index) {
+    public void insertItemAt(Object element, int index) {
         selectedItemReminder = getSelectedItem();
         if (dataModel instanceof MutableComboBoxModel) {
-            ((MutableComboBoxModel)dataModel).insertElementAt(element, index);
+            ((MutableComboBoxModel) dataModel).insertElementAt(element, index);
         } else {
             throw new RuntimeException("Cannot modify immutable data model");
         }
     }
 
-    public void removeItem(final Object element) {
+    public void removeItem(Object element) {
         selectedItemReminder = getSelectedItem();
         if (dataModel instanceof MutableComboBoxModel) {
-            ((MutableComboBoxModel)dataModel).removeElement(element);
+            ((MutableComboBoxModel) dataModel).removeElement(element);
         } else {
             throw new RuntimeException("Cannot modify immutable data model");
         }
     }
 
-    public void removeItemAt(final int index) {
+    public void removeItemAt(int index) {
         selectedItemReminder = getSelectedItem();
         if (dataModel instanceof MutableComboBoxModel) {
-            ((MutableComboBoxModel)dataModel).removeElementAt(index);
+            ((MutableComboBoxModel) dataModel).removeElementAt(index);
         } else {
             throw new RuntimeException("Cannot modify immutable data model");
         }
@@ -383,7 +421,7 @@
     public void removeAllItems() {
         selectedItemReminder = getSelectedItem();
         if (dataModel instanceof MutableComboBoxModel) {
-            MutableComboBoxModel model = (MutableComboBoxModel)dataModel;
+            MutableComboBoxModel model = (MutableComboBoxModel) dataModel;
             while (model.getSize() > 0) {
                 model.removeElementAt(0);
             }
@@ -396,49 +434,47 @@
         return dataModel.getSize();
     }
 
-    public Object getItemAt(final int index) {
+    public Object getItemAt(int index) {
         if (index < 0 || index >= dataModel.getSize()) {
             return null;
         }
-
         return dataModel.getElementAt(index);
     }
 
-
-    public void addItemListener(final ItemListener l) {
+    public void addItemListener(ItemListener l) {
         listenerList.add(ItemListener.class, l);
     }
 
-    public void removeItemListener(final ItemListener l) {
+    public void removeItemListener(ItemListener l) {
         listenerList.remove(ItemListener.class, l);
     }
 
     public ItemListener[] getItemListeners() {
-        return (ItemListener[])listenerList.getListeners(ItemListener.class);
+        return listenerList.getListeners(ItemListener.class);
     }
 
-    public void addActionListener(final ActionListener l) {
+    public void addActionListener(ActionListener l) {
         listenerList.add(ActionListener.class, l);
     }
 
-    public void removeActionListener(final ActionListener l) {
+    public void removeActionListener(ActionListener l) {
         listenerList.remove(ActionListener.class, l);
     }
 
     public ActionListener[] getActionListeners() {
-        return (ActionListener[])listenerList.getListeners(ActionListener.class);
+        return listenerList.getListeners(ActionListener.class);
     }
 
-    public void addPopupMenuListener(final PopupMenuListener l) {
+    public void addPopupMenuListener(PopupMenuListener l) {
         listenerList.add(PopupMenuListener.class, l);
     }
 
-    public void removePopupMenuListener(final PopupMenuListener l) {
+    public void removePopupMenuListener(PopupMenuListener l) {
         listenerList.remove(PopupMenuListener.class, l);
     }
 
     public PopupMenuListener[] getPopupMenuListeners() {
-        return (PopupMenuListener[])listenerList.getListeners(PopupMenuListener.class);
+        return listenerList.getListeners(PopupMenuListener.class);
     }
 
     public void firePopupMenuWillBecomeVisible() {
@@ -465,7 +501,7 @@
         }
     }
 
-    public void setActionCommand(final String command) {
+    public void setActionCommand(String command) {
         actionCommand = command;
     }
 
@@ -473,7 +509,6 @@
         return actionCommand;
     }
 
-
     public void showPopup() {
         setPopupVisible(true);
     }
@@ -482,7 +517,7 @@
         setPopupVisible(false);
     }
 
-    public void setPopupVisible(final boolean isVisible) {
+    public void setPopupVisible(boolean isVisible) {
         getUI().setPopupVisible(this, isVisible);
     }
 
@@ -490,11 +525,10 @@
         return getUI().isPopupVisible(this);
     }
 
-    public void setAction(final Action action) {
+    public void setAction(Action action) {
         if (this.action == action) {
             return;
         }
-
         Action oldValue = this.action;
         if (oldValue != null) {
             if (hasListener(ActionListener.class, oldValue)) {
@@ -504,7 +538,6 @@
                 oldValue.removePropertyChangeListener(actionPropertyChangeListener);
             }
         }
-
         this.action = action;
         if (action != null) {
             if (!hasListener(ActionListener.class, action)) {
@@ -513,7 +546,6 @@
             actionPropertyChangeListener = createActionPropertyChangeListener(this.action);
             this.action.addPropertyChangeListener(actionPropertyChangeListener);
         }
-
         firePropertyChange(StringConstants.ACTION_PROPERTY_CHANGED, oldValue, action);
         configurePropertiesFromAction(action);
     }
@@ -522,11 +554,11 @@
         return action;
     }
 
-    protected void configurePropertiesFromAction(final Action action) {
+    protected void configurePropertiesFromAction(Action action) {
         if (action != null) {
-            setToolTipText((String)action.getValue(Action.SHORT_DESCRIPTION));
+            setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
             setEnabled(action.isEnabled());
-            setActionCommand((String)action.getValue(Action.ACTION_COMMAND_KEY));
+            setActionCommand((String) action.getValue(Action.ACTION_COMMAND_KEY));
         } else {
             setActionCommand(null);
             setEnabled(true);
@@ -534,55 +566,55 @@
         }
     }
 
-    public void actionPerformed(final ActionEvent e) {
+    public void actionPerformed(ActionEvent e) {
         setSelectedItem(editor.getItem());
         getUI().setPopupVisible(this, false);
     }
 
-    public void contentsChanged(final ListDataEvent e) {
+    public void contentsChanged(ListDataEvent e) {
         selectedItemChanged();
         fireActionEvent();
     }
 
-    public void intervalAdded(final ListDataEvent e) {
+    public void intervalAdded(ListDataEvent e) {
     }
 
-    public void intervalRemoved(final ListDataEvent e) {
+    public void intervalRemoved(ListDataEvent e) {
     }
 
-    public void setEnabled(final boolean isEnabled) {
+    @Override
+    public void setEnabled(boolean isEnabled) {
         super.setEnabled(isEnabled);
         if (action != null) {
             action.setEnabled(isEnabled);
         }
     }
 
-    public void configureEditor(final ComboBoxEditor editor, final Object item) {
+    public void configureEditor(ComboBoxEditor editor, Object item) {
         editor.setItem(item);
     }
 
-    public void processKeyEvent(final KeyEvent e) {
+    @Override
+    public void processKeyEvent(KeyEvent e) {
         if (e.getKeyCode() == KeyEvent.VK_TAB) {
             hidePopup();
         }
         super.processKeyEvent(e);
     }
 
-    public boolean selectWithKeyChar(final char keyChar) {
+    public boolean selectWithKeyChar(char keyChar) {
         if (keySelectionManager == null) {
             keySelectionManager = createDefaultKeySelectionManager();
         }
-
         int index = keySelectionManager.selectionForKey(keyChar, getModel());
         if (index != -1) {
             setSelectedIndex(index);
             return true;
-        } else {
-            return false;
         }
+        return false;
     }
 
-    public void setKeySelectionManager(final KeySelectionManager manager) {
+    public void setKeySelectionManager(KeySelectionManager manager) {
         keySelectionManager = manager;
     }
 
@@ -590,34 +622,33 @@
         return keySelectionManager;
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         if (accessibleContext == null) {
             accessibleContext = new AccessibleJComboBox();
         }
-
         return accessibleContext;
     }
 
-
     protected void installAncestorListener() {
         addAncestorListener(new AncestorListener() {
-            public void ancestorAdded(final AncestorEvent e) {
+            public void ancestorAdded(AncestorEvent e) {
             }
 
-            public void ancestorMoved(final AncestorEvent e) {
+            public void ancestorMoved(AncestorEvent e) {
             }
 
-            public void ancestorRemoved(final AncestorEvent e) {
+            public void ancestorRemoved(AncestorEvent e) {
                 hidePopup();
             }
         });
     }
 
-    protected PropertyChangeListener createActionPropertyChangeListener(final Action a) {
+    protected PropertyChangeListener createActionPropertyChangeListener(Action a) {
         return new ActionPropertyChangeListener();
     }
 
-    protected void fireItemStateChanged(final ItemEvent e) {
+    protected void fireItemStateChanged(ItemEvent e) {
         ItemListener[] listeners = getItemListeners();
         for (int i = 0; i < listeners.length; i++) {
             listeners[i].itemStateChanged(e);
@@ -634,12 +665,14 @@
 
     protected void selectedItemChanged() {
         if (selectedItemReminder != null) {
-            ItemEvent itemEvent = new ItemEvent(JComboBox.this, ItemEvent.ITEM_STATE_CHANGED, selectedItemReminder, ItemEvent.DESELECTED);
+            ItemEvent itemEvent = new ItemEvent(JComboBox.this, ItemEvent.ITEM_STATE_CHANGED,
+                    selectedItemReminder, ItemEvent.DESELECTED);
             fireItemStateChanged(itemEvent);
         }
         Object newSelection = dataModel.getSelectedItem();
         if (isEditable || getIndex(newSelection) != -1) {
-            ItemEvent itemEvent = new ItemEvent(JComboBox.this, ItemEvent.ITEM_STATE_CHANGED, newSelection, ItemEvent.SELECTED);
+            ItemEvent itemEvent = new ItemEvent(JComboBox.this, ItemEvent.ITEM_STATE_CHANGED,
+                    newSelection, ItemEvent.SELECTED);
             fireItemStateChanged(itemEvent);
         }
     }
@@ -648,21 +681,19 @@
         return new DefaultKeySelectionManager();
     }
 
-    private int getIndex(final Object element) {
+    private int getIndex(Object element) {
         return getIndex(element, dataModel);
     }
 
-    private int getIndex(final Object element, final ComboBoxModel model) {
+    private int getIndex(Object element, ComboBoxModel model) {
         if (element == null) {
             return -1;
         }
-
         for (int i = 0; i < model.getSize(); i++) {
             if (element.equals(model.getElementAt(i))) {
                 return i;
             }
         }
-
         return -1;
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenu.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenu.java?view=diff&rev=478753&r1=478752&r2=478753
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenu.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenu.java Thu Nov 23 18:41:15 2006
@@ -14,10 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- */
+
 package javax.swing;
 
 import java.awt.Component;
@@ -28,74 +25,92 @@
 import java.awt.event.WindowEvent;
 import java.beans.PropertyChangeListener;
 import java.io.Serializable;
-
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleSelection;
 import javax.swing.event.MenuEvent;
 import javax.swing.event.MenuListener;
-
+import org.apache.harmony.luni.util.NotImplementedException;
 import org.apache.harmony.x.swing.Utilities;
 
-
+/**
+ * <p>
+ * <i>JMenu</i>
+ * </p>
+ * <h3>Implementation Notes:</h3>
+ * <ul>
+ * <li>The <code>serialVersionUID</code> fields are explicitly declared as a performance
+ * optimization, not as guarantee of serialization compatibility.</li>
+ * </ul>
+ */
 public class JMenu extends JMenuItem implements Accessible, MenuElement {
+    private static final long serialVersionUID = 6344812061970456262L;
 
     // TODO implement accessibility
     protected class AccessibleJMenu extends AccessibleJMenuItem implements AccessibleSelection {
-        public void addAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("not implemented");
+        private static final long serialVersionUID = -7871723353224195081L;
+
+        public void addAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
         public void clearAccessibleSelection() {
-            throw new UnsupportedOperationException("not implemented");
+            throw new NotImplementedException();
         }
 
+        @Override
         public int getAccessibleChildrenCount() {
-            throw new UnsupportedOperationException("not implemented");
+            throw new NotImplementedException();
         }
 
-        public Accessible getAccessibleChild(final int i) {
-            throw new UnsupportedOperationException("not implemented");
+        @Override
+        public Accessible getAccessibleChild(int i) {
+            throw new NotImplementedException();
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.MENU;
         }
 
+        @Override
         public AccessibleSelection getAccessibleSelection() {
-            throw new UnsupportedOperationException("not implemented");
+            throw new NotImplementedException();
         }
 
-        public Accessible getAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("not implemented");
+        public Accessible getAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
         public int getAccessibleSelectionCount() {
-            throw new UnsupportedOperationException("not implemented");
+            throw new NotImplementedException();
         }
 
-        public boolean isAccessibleChildSelected(final int i) {
-            throw new UnsupportedOperationException("not implemented");
+        public boolean isAccessibleChildSelected(int i) {
+            throw new NotImplementedException();
         }
 
-        public void removeAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("not implemented");
+        public void removeAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
         public void selectAllAccessibleSelection() {
-            throw new UnsupportedOperationException("not implemented");
+            throw new NotImplementedException();
         }
     }
 
     protected class WinListener extends WindowAdapter implements Serializable {
+        private static final long serialVersionUID = 1L;
+
         private final JPopupMenu popup;
 
-        public WinListener(final JPopupMenu p) {
+        public WinListener(JPopupMenu p) {
             popup = p;
         }
 
-        public void windowClosing(final WindowEvent e) {
+        @Override
+        public void windowClosing(WindowEvent e) {
             setSelected(false);
         }
     }
@@ -104,78 +119,84 @@
 
     private static final String UI_CLASS_ID = "MenuUI";
 
-    private static final Object ALL_ACTION_PROPERTIES = new Object() {  //$NON-LOCK-1$
-        public boolean equals(final Object o) {
+    private static final Object ALL_ACTION_PROPERTIES = new Object() { //$NON-LOCK-1$
+        @Override
+        public boolean equals(Object o) {
             return !Action.ACCELERATOR_KEY.equals(o);
         }
     };
 
     private int delay = 200;
+
     private JPopupMenu popup;
+
     private transient MenuEvent menuEvent;
+
     private transient int[] uiMnemonicModifiers;
+
     private transient boolean crossMenuMnemonic;
 
     public JMenu() {
         super();
     }
 
-    public JMenu(final String text) {
+    public JMenu(String text) {
         super(text);
     }
 
-    public JMenu(final String text, final boolean b) {
+    public JMenu(String text, boolean b) {
         super(text);
     }
 
-    public JMenu(final Action action) {
+    public JMenu(Action action) {
         setDefaultModelAndFocus();
         setAction(action);
         init(getText(), getIcon());
     }
 
-    void configurePropertyFromAction(final Action action, final Object propertyName) {
+    @Override
+    void configurePropertyFromAction(Action action, Object propertyName) {
         if (propertyName == null || propertyName.equals(Action.ACCELERATOR_KEY)) {
             return;
         }
         super.configurePropertyFromAction(action, propertyName);
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         return (accessibleContext == null) ? (accessibleContext = new AccessibleJMenu())
                 : accessibleContext;
     }
 
-    protected PropertyChangeListener createActionChangeListener(final JMenuItem item) {
+    protected PropertyChangeListener createActionChangeListener(JMenuItem item) {
         return item.createActionPropertyChangeListener(getAction());
     }
 
-    protected JMenuItem createActionComponent(final Action action) {
+    protected JMenuItem createActionComponent(Action action) {
         return JMenuItem.createJMenuItem(action);
     }
 
-    protected WinListener createWinListener(final JPopupMenu popup) {
+    protected WinListener createWinListener(JPopupMenu popup) {
         return new WinListener(popup);
     }
 
-    public void addMenuListener(final MenuListener listener) {
+    public void addMenuListener(MenuListener listener) {
         listenerList.add(MenuListener.class, listener);
     }
 
-    public void removeMenuListener(final MenuListener listener) {
+    public void removeMenuListener(MenuListener listener) {
         listenerList.remove(MenuListener.class, listener);
     }
 
     public MenuListener[] getMenuListeners() {
-        return (MenuListener[])getListeners(MenuListener.class);
+        return getListeners(MenuListener.class);
     }
 
     protected void fireMenuCanceled() {
         final MenuListener[] listeners = getMenuListeners();
-        if (listeners.length == 0){
+        if (listeners.length == 0) {
             return;
         }
-
         if (menuEvent == null) {
             menuEvent = new MenuEvent(this);
         }
@@ -186,10 +207,9 @@
 
     protected void fireMenuDeselected() {
         final MenuListener[] listeners = getMenuListeners();
-        if (listeners.length == 0){
+        if (listeners.length == 0) {
             return;
         }
-
         if (menuEvent == null) {
             menuEvent = new MenuEvent(this);
         }
@@ -200,10 +220,9 @@
 
     protected void fireMenuSelected() {
         final MenuListener[] listeners = getMenuListeners();
-        if (listeners.length == 0){
+        if (listeners.length == 0) {
             return;
         }
-
         if (menuEvent == null) {
             menuEvent = new MenuEvent(this);
         }
@@ -212,7 +231,8 @@
         }
     }
 
-    public void doClick(final int time) {
+    @Override
+    public void doClick(int time) {
         final MenuElement[] path = Utilities.getMenuElementPath(getPopupMenu());
         MenuSelectionManager.defaultManager().setSelectedPath(path);
     }
@@ -227,9 +247,8 @@
 
     protected Point getPopupMenuOrigin() {
         final boolean leftToRight = getComponentOrientation().isLeftToRight();
-        Point result = Utilities.getPopupLocation(getBounds(),
-                                                  getPopupMenu().getPreferredSize(),
-                                                  leftToRight, !isTopLevelMenu());
+        Point result = Utilities.getPopupLocation(getBounds(), getPopupMenu()
+                .getPreferredSize(), leftToRight, !isTopLevelMenu());
         String prefix = isTopLevelMenu() ? "Menu.menuPopupOffset" : "Menu.submenuPopupOffset";
         int xOffset = UIManager.getInt(prefix + "X");
         int yOffset = UIManager.getInt(prefix + "Y");
@@ -244,7 +263,7 @@
         return popup != null ? popup.isVisible() : false;
     }
 
-    public void setPopupMenuVisible(final boolean visible) {
+    public void setPopupMenuVisible(boolean visible) {
         if (visible == isPopupMenuVisible()) {
             return;
         }
@@ -259,11 +278,13 @@
         }
     }
 
+    @Override
     public String getUIClassID() {
         return UI_CLASS_ID;
     }
 
-    public void setSelected(final boolean selected) {
+    @Override
+    public void setSelected(boolean selected) {
         if (selected != isSelected()) {
             super.setSelected(selected);
             if (selected) {
@@ -282,29 +303,33 @@
         return (getParent() instanceof JMenuBar);
     }
 
-    public void menuSelectionChanged(final boolean b) {
+    @Override
+    public void menuSelectionChanged(boolean b) {
         setSelected(b);
     }
 
-    public void setAccelerator(final KeyStroke keyStroke) {
+    @Override
+    public void setAccelerator(KeyStroke keyStroke) {
         throw new Error("setAccelerator() in not used for JMenu. Use setMnemonic() instead.");
     }
 
-    public void setComponentOrientation(final ComponentOrientation orientation) {
+    @Override
+    public void setComponentOrientation(ComponentOrientation orientation) {
         super.setComponentOrientation(orientation);
         if (popup != null) {
             popup.setComponentOrientation(orientation);
         }
     }
 
-    public void applyComponentOrientation(final ComponentOrientation orientation) {
+    @Override
+    public void applyComponentOrientation(ComponentOrientation orientation) {
         super.applyComponentOrientation(orientation);
         if (popup != null) {
             popup.applyComponentOrientation(orientation);
         }
     }
 
-    public void setDelay(final int delay) {
+    public void setDelay(int delay) {
         if (delay < 0) {
             throw new IllegalArgumentException("Delay must be positive");
         }
@@ -315,29 +340,31 @@
         return delay;
     }
 
-    public void setMenuLocation(final int x, final int y) {
+    public void setMenuLocation(int x, int y) {
         if (popup != null) {
             popup.setLocation(x, y);
         }
     }
 
-    public Component add(final Component c) {
+    @Override
+    public Component add(Component c) {
         return getPopupMenu().add(c);
     }
 
-    public JMenuItem add(final Action action) {
+    public JMenuItem add(Action action) {
         return getPopupMenu().add(action);
     }
 
-    public Component add(final Component c, final int index) {
+    @Override
+    public Component add(Component c, int index) {
         return getPopupMenu().add(c, index);
     }
 
-    public JMenuItem add(final String text) {
+    public JMenuItem add(String text) {
         return getPopupMenu().add(text);
     }
 
-    public JMenuItem add(final JMenuItem item) {
+    public JMenuItem add(JMenuItem item) {
         return getPopupMenu().add(item);
     }
 
@@ -345,39 +372,39 @@
         getPopupMenu().addSeparator();
     }
 
-    public void insert(final String text, final int index) {
+    public void insert(String text, int index) {
         JMenuItem item = new JMenuItem(text);
         getPopupMenu().insert(item, getValidIndex(index));
     }
 
-    public JMenuItem insert(final JMenuItem item, final int index) {
+    public JMenuItem insert(JMenuItem item, int index) {
         getPopupMenu().insert(item, index);
         return item;
     }
 
-    public JMenuItem insert(final Action action, final int index) {
+    public JMenuItem insert(Action action, int index) {
         JMenuItem item = createActionComponent(action);
         getPopupMenu().insert(item, getValidIndex(index));
         return item;
     }
 
-    public void insertSeparator(final int index) {
+    public void insertSeparator(int index) {
         getPopupMenu().insert(new JPopupMenu.Separator(), getValidIndex(index));
     }
 
-    public Component getMenuComponent(final int index) {
+    public Component getMenuComponent(int index) {
         if (popup == null || index < 0 || index >= getMenuComponentCount()) {
             return null;
         }
         return popup.getComponent(index);
     }
 
-    public JMenuItem getItem(final int index) {
+    public JMenuItem getItem(int index) {
         if (popup == null || index < 0 || index >= getItemCount()) {
             return null;
         }
         Component c = popup.getComponent(index);
-        return (c instanceof JMenuItem) ? (JMenuItem)c : null;
+        return (c instanceof JMenuItem) ? (JMenuItem) c : null;
     }
 
     public int getItemCount() {
@@ -392,11 +419,13 @@
         return (popup != null) ? popup.getComponents() : new Component[0];
     }
 
+    @Override
     public MenuElement[] getSubElements() {
-        return new MenuElement[] {getPopupMenu()};
+        return new MenuElement[] { getPopupMenu() };
     }
 
-    public void remove(final Component c) {
+    @Override
+    public void remove(Component c) {
         if (popup == null) {
             return;
         }
@@ -409,23 +438,25 @@
         }
     }
 
-    public void remove(final int i) {
+    @Override
+    public void remove(int i) {
         if (popup != null) {
             popup.remove(i);
         }
     }
 
-    public void remove(final JMenuItem item) {
-        remove((Component)item);
+    public void remove(JMenuItem item) {
+        remove((Component) item);
     }
 
+    @Override
     public void removeAll() {
         if (popup != null) {
             popup.removeAll();
         }
     }
 
-    public boolean isMenuComponent(final Component c) {
+    public boolean isMenuComponent(Component c) {
         if (c == null) {
             return false;
         }
@@ -439,33 +470,35 @@
             }
         }
         for (int i = 0; i < subComponents.length; i++) {
-            if (subComponents[i] instanceof JMenu &&
-                    ((JMenu)subComponents[i]).isMenuComponent(c)) {
-
+            if (subComponents[i] instanceof JMenu
+                    && ((JMenu) subComponents[i]).isMenuComponent(c)) {
                 return true;
             }
         }
-
         return false;
     }
 
+    @Override
     public void updateUI() {
         super.updateUI();
-        uiMnemonicModifiers = (int[])UIManager.get("Menu.shortcutKeys");
+        uiMnemonicModifiers = (int[]) UIManager.get("Menu.shortcutKeys");
         crossMenuMnemonic = UIManager.getBoolean("Menu.crossMenuMnemonic");
     }
 
+    @Override
     void setDefaultModelAndFocus() {
         setModel(createDefaultModel());
         setFocusPainted(false);
         setHorizontalAlignment(SwingConstants.LEADING);
     }
 
+    @Override
     Object getActionPropertiesFilter() {
         return ALL_ACTION_PROPERTIES;
     }
 
-    boolean isMnemonicKeyStroke(final KeyStroke keyStroke) {
+    @Override
+    boolean isMnemonicKeyStroke(KeyStroke keyStroke) {
         if (keyStroke.getKeyCode() != getMnemonic()) {
             return false;
         }
@@ -482,15 +515,13 @@
         return isStandardModifiers(modifiers);
     }
 
-    private boolean isMnemonicModifiers(final int modifiers, final boolean forceStandardCheck) {
+    private boolean isMnemonicModifiers(int modifiers, boolean forceStandardCheck) {
         if (forceStandardCheck && isStandardModifiers(modifiers)) {
             return true;
         }
-
         if (Utilities.isEmptyArray(uiMnemonicModifiers)) {
             return false;
         }
-
         for (int i = 0; i < uiMnemonicModifiers.length; i++) {
             if ((modifiers & uiMnemonicModifiers[i]) != 0) {
                 return true;
@@ -499,12 +530,11 @@
         return false;
     }
 
-    private boolean isStandardModifiers(final int modifiers) {
+    private boolean isStandardModifiers(int modifiers) {
         return (modifiers == 0) || (modifiers & InputEvent.ALT_DOWN_MASK) != 0;
     }
 
-    private int getValidIndex(final int index) {
+    private int getValidIndex(int index) {
         return index < getItemCount() ? index : getItemCount();
     }
 }
-

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenuBar.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenuBar.java?view=diff&rev=478753&r1=478752&r2=478753
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenuBar.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JMenuBar.java Thu Nov 23 18:41:15 2006
@@ -14,10 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- */
+
 package javax.swing;
 
 import java.awt.Component;
@@ -25,103 +22,119 @@
 import java.awt.Insets;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
-
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleSelection;
 import javax.accessibility.AccessibleStateSet;
 import javax.swing.plaf.MenuBarUI;
-
+import org.apache.harmony.luni.util.NotImplementedException;
 import org.apache.harmony.x.swing.StringConstants;
 import org.apache.harmony.x.swing.Utilities;
 
-
+/**
+ * <p>
+ * <i>JMenuBar</i>
+ * </p>
+ * <h3>Implementation Notes:</h3>
+ * <ul>
+ * <li>The <code>serialVersionUID</code> fields are explicitly declared as a performance
+ * optimization, not as guarantee of serialization compatibility.</li>
+ * </ul>
+ */
 public class JMenuBar extends JComponent implements Accessible, MenuElement {
+    private static final long serialVersionUID = 6620404810314292434L;
 
     // TODO: implement
-    protected class AccessibleJMenuBar extends AccessibleJComponent implements AccessibleSelection {
-        public void addAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+    protected class AccessibleJMenuBar extends AccessibleJComponent implements
+            AccessibleSelection {
+        private static final long serialVersionUID = 1L;
+
+        public void addAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
         public void clearAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
-        public Accessible getAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public Accessible getAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
         public int getAccessibleSelectionCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.MENU_BAR;
         }
 
+        @Override
         public AccessibleSelection getAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
+        @Override
         public AccessibleStateSet getAccessibleStateSet() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
 
-        public boolean isAccessibleChildSelected(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public boolean isAccessibleChildSelected(int i) {
+            throw new NotImplementedException();
         }
 
-        public void removeAccessibleSelection(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+        public void removeAccessibleSelection(int i) {
+            throw new NotImplementedException();
         }
 
         public void selectAllAccessibleSelection() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
     }
 
     private final static String UI_CLASS_ID = "MenuBarUI";
 
     private SingleSelectionModel selectionModel = new DefaultSingleSelectionModel();
+
     private boolean borderPainted = true;
+
     private Insets margin;
 
     public JMenuBar() {
         updateUI();
     }
 
-    public JMenu add(final JMenu menu) {
+    public JMenu add(JMenu menu) {
         super.add(menu);
         return menu;
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         return (accessibleContext == null) ? (accessibleContext = new AccessibleJMenuBar())
                 : accessibleContext;
     }
 
-    public JMenu getMenu(final int index) {
+    public JMenu getMenu(int index) {
         if (index < 0 || index >= getMenuCount()) {
             return null;
         }
         Component c = getComponent(index);
-        return (c instanceof JMenu) ? (JMenu)c : null;
+        return (c instanceof JMenu) ? (JMenu) c : null;
     }
 
     public int getMenuCount() {
         return getComponentCount();
     }
 
-    /**
-     * @deprecated
-     */
-    public Component getComponentAtIndex(final int index) {
+    @Deprecated
+    public Component getComponentAtIndex(int index) {
         return getComponent(index);
     }
 
-    public int getComponentIndex(final Component c) {
+    public int getComponentIndex(Component c) {
         for (int i = 0; i < getComponentCount(); i++) {
             if (getComponent(i) == c) {
                 return i;
@@ -134,7 +147,7 @@
         return Utilities.getSubElements(this);
     }
 
-    public void setSelectionModel(final SingleSelectionModel model) {
+    public void setSelectionModel(SingleSelectionModel model) {
         SingleSelectionModel oldValue = selectionModel;
         selectionModel = model;
         firePropertyChange(StringConstants.SELECTION_MODEL_PROPERTY, oldValue, selectionModel);
@@ -144,7 +157,7 @@
         return selectionModel;
     }
 
-    public void setSelected(final Component selection) {
+    public void setSelected(Component selection) {
         if (selectionModel != null) {
             selectionModel.setSelectedIndex(getComponentIndex(selection));
         }
@@ -154,25 +167,27 @@
         return (selectionModel != null) ? selectionModel.isSelected() : false;
     }
 
-    public void setBorderPainted(final boolean painted) {
+    public void setBorderPainted(boolean painted) {
         boolean oldValue = borderPainted;
         borderPainted = painted;
-        firePropertyChange(AbstractButton.BORDER_PAINTED_CHANGED_PROPERTY,
-                           oldValue,
-                           borderPainted);
+        firePropertyChange(AbstractButton.BORDER_PAINTED_CHANGED_PROPERTY, oldValue,
+                borderPainted);
     }
 
     public boolean isBorderPainted() {
         return borderPainted;
     }
 
-    protected void paintBorder(final Graphics g) {
+    @Override
+    protected void paintBorder(Graphics g) {
         if (isBorderPainted()) {
             super.paintBorder(g);
         }
     }
 
-    protected boolean processKeyBinding(final KeyStroke ks, final KeyEvent event, final int condition, final boolean pressed) {
+    @Override
+    protected boolean processKeyBinding(KeyStroke ks, KeyEvent event, int condition,
+            boolean pressed) {
         MenuSelectionManager.defaultManager().processKeyEvent(event);
         if (event.isConsumed()) {
             return true;
@@ -183,20 +198,21 @@
         return SwingUtilities.processKeyEventOnChildren(this, event);
     }
 
-    public void processKeyEvent(final KeyEvent e, final MenuElement[] path, final MenuSelectionManager manager) {
+    public void processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager) {
     }
 
-    public void processMouseEvent(final MouseEvent event, final MenuElement[] path, final MenuSelectionManager manager) {
+    public void processMouseEvent(MouseEvent event, MenuElement[] path,
+            MenuSelectionManager manager) {
     }
 
-    public void menuSelectionChanged(final boolean isIncluded) {
+    public void menuSelectionChanged(boolean isIncluded) {
     }
 
     public Component getComponent() {
         return this;
     }
 
-    public void setHelpMenu(final JMenu menu) {
+    public void setHelpMenu(JMenu menu) {
         throw new Error("setHelpMenu() hasn't been implemented yet");
     }
 
@@ -204,7 +220,7 @@
         throw new Error("getHelpMenu() hasn't been implemented yet");
     }
 
-    public void setMargin(final Insets margin) {
+    public void setMargin(Insets margin) {
         Insets oldValue = this.margin;
         this.margin = margin;
         firePropertyChange(AbstractButton.MARGIN_CHANGED_PROPERTY, oldValue, margin);
@@ -214,20 +230,21 @@
         return margin;
     }
 
+    @Override
     public String getUIClassID() {
         return UI_CLASS_ID;
     }
 
     public MenuBarUI getUI() {
-        return (MenuBarUI)ui;
+        return (MenuBarUI) ui;
     }
 
-    public void setUI(final MenuBarUI ui) {
+    public void setUI(MenuBarUI ui) {
         super.setUI(ui);
     }
 
+    @Override
     public void updateUI() {
-        setUI((MenuBarUI)UIManager.getUI(this));
+        setUI((MenuBarUI) UIManager.getUI(this));
     }
 }
-

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JSpinner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JSpinner.java?view=diff&rev=478753&r1=478752&r2=478753
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JSpinner.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JSpinner.java Thu Nov 23 18:41:15 2006
@@ -14,10 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Dennis Ushakov
- * @version $Revision$
- */
 
 package javax.swing;
 
@@ -35,7 +31,6 @@
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.List;
-
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
 import javax.accessibility.AccessibleContext;
@@ -53,129 +48,186 @@
 import javax.swing.text.DefaultFormatterFactory;
 import javax.swing.text.DocumentFilter;
 import javax.swing.text.NumberFormatter;
-
+import org.apache.harmony.luni.util.NotImplementedException;
 import org.apache.harmony.x.swing.StringConstants;
 import org.apache.harmony.x.swing.Utilities;
 
-
+/**
+ * <p>
+ * <i>JSpinner</i>
+ * </p>
+ * <h3>Implementation Notes:</h3>
+ * <ul>
+ * <li>The <code>serialVersionUID</code> fields are explicitly declared as a performance
+ * optimization, not as guarantee of serialization compatibility.</li>
+ * </ul>
+ */
 public class JSpinner extends JComponent implements Accessible {
-    protected class AccessibleJSpinner extends JComponent.AccessibleJComponent implements AccessibleValue, AccessibleAction, AccessibleText, AccessibleEditableText, ChangeListener {
+    private static final long serialVersionUID = 5455034942343575490L;
+
+    protected class AccessibleJSpinner extends JComponent.AccessibleJComponent implements
+            AccessibleValue, AccessibleAction, AccessibleText, AccessibleEditableText,
+            ChangeListener {
+        private static final long serialVersionUID = -8871493856204319541L;
+
         protected AccessibleJSpinner() {
         }
-        public void stateChanged(final ChangeEvent e) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void stateChanged(ChangeEvent e) {
+            throw new NotImplementedException();
         }
+
+        @Override
         public AccessibleRole getAccessibleRole() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
+        @Override
         public int getAccessibleChildrenCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
-        public Accessible getAccessibleChild(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        @Override
+        public Accessible getAccessibleChild(int i) {
+            throw new NotImplementedException();
         }
+
+        @Override
         public AccessibleAction getAccessibleAction() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
+        @Override
         public AccessibleText getAccessibleText() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
+        @Override
         public AccessibleValue getAccessibleValue() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
         public Number getCurrentAccessibleValue() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
-        public boolean setCurrentAccessibleValue(final Number n) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public boolean setCurrentAccessibleValue(Number n) {
+            throw new NotImplementedException();
         }
+
         public Number getMinimumAccessibleValue() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
         public Number getMaximumAccessibleValue() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
         public int getAccessibleActionCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
-        public String getAccessibleActionDescription(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public String getAccessibleActionDescription(int i) {
+            throw new NotImplementedException();
         }
-        public boolean doAccessibleAction(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public boolean doAccessibleAction(int i) {
+            throw new NotImplementedException();
         }
-        public int getIndexAtPoint(final Point p) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public int getIndexAtPoint(Point p) {
+            throw new NotImplementedException();
         }
-        public Rectangle getCharacterBounds(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public Rectangle getCharacterBounds(int i) {
+            throw new NotImplementedException();
         }
+
         public int getCharCount() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
         public int getCaretPosition() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
-        public String getAtIndex(final int part, final int index) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public String getAtIndex(int part, int index) {
+            throw new NotImplementedException();
         }
-        public String getAfterIndex(final int part, final int index) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public String getAfterIndex(int part, int index) {
+            throw new NotImplementedException();
         }
-        public String getBeforeIndex(final int part, final int index) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public String getBeforeIndex(int part, int index) {
+            throw new NotImplementedException();
         }
-        public AttributeSet getCharacterAttribute(final int i) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public AttributeSet getCharacterAttribute(int i) {
+            throw new NotImplementedException();
         }
+
         public int getSelectionStart() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
         public int getSelectionEnd() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
+
         public String getSelectedText() {
-            throw new UnsupportedOperationException("Not implemented");
+            throw new NotImplementedException();
         }
-        public void setTextContents(final String s) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void setTextContents(String s) {
+            throw new NotImplementedException();
         }
-        public void insertTextAtIndex(final int index,final String s) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void insertTextAtIndex(int index, String s) {
+            throw new NotImplementedException();
         }
-        public String getTextRange(final int startIndex, final int endIndex) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public String getTextRange(int startIndex, int endIndex) {
+            throw new NotImplementedException();
         }
-        public void delete(final int startIndex, final int endIndex) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void delete(int startIndex, int endIndex) {
+            throw new NotImplementedException();
         }
-        public void cut(final int startIndex, final int endIndex) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void cut(int startIndex, int endIndex) {
+            throw new NotImplementedException();
         }
-        public void paste(final int startIndex) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void paste(int startIndex) {
+            throw new NotImplementedException();
         }
-        public void replaceText(final int startIndex, final int endIndex, final String s) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void replaceText(int startIndex, int endIndex, String s) {
+            throw new NotImplementedException();
         }
-        public void selectText(final int startIndex, final int endIndex) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void selectText(int startIndex, int endIndex) {
+            throw new NotImplementedException();
         }
-        public void setAttributes(final int startIndex, final int endIndex,final AttributeSet as) {
-            throw new UnsupportedOperationException("Not implemented");
+
+        public void setAttributes(int startIndex, int endIndex, AttributeSet as) {
+            throw new NotImplementedException();
         }
     }
 
-    public static class DefaultEditor extends JPanel implements ChangeListener, PropertyChangeListener, LayoutManager {
+    public static class DefaultEditor extends JPanel implements ChangeListener,
+            PropertyChangeListener, LayoutManager {
+        private static final long serialVersionUID = 6977154593437159148L;
+
         private JFormattedTextField text;
+
         private JSpinner spinner;
 
-        public DefaultEditor(final JSpinner spinner) {
+        public DefaultEditor(JSpinner spinner) {
             this.spinner = spinner;
             setLayout(this);
-
             spinner.addChangeListener(this);
-
             text = new JFormattedTextField();
             text.setEditable(false);
             text.setValue(spinner.getModel().getValue());
@@ -193,19 +245,19 @@
             return text;
         }
 
-        public void stateChanged(final ChangeEvent e) {
+        public void stateChanged(ChangeEvent e) {
             if (this != spinner.getEditor()) {
                 return;
             }
             text.setValue(spinner.getValue());
         }
 
-        public void propertyChange(final PropertyChangeEvent e) {
+        public void propertyChange(PropertyChangeEvent e) {
             if (e.getSource() != text || this != spinner.getEditor()) {
                 return;
             }
             if (StringConstants.VALUE_PROPERTY_NAME.equals(e.getPropertyName())) {
-              try {
+                try {
                     spinner.setValue(e.getNewValue());
                 } catch (IllegalArgumentException ex) {
                     text.setValue(e.getOldValue());
@@ -213,21 +265,21 @@
             }
         }
 
-        public void addLayoutComponent(final String name, final Component child) {
+        public void addLayoutComponent(String name, Component child) {
         }
 
-        public void removeLayoutComponent(final Component child) {
+        public void removeLayoutComponent(Component child) {
         }
 
-        public Dimension preferredLayoutSize(final Container parent) {
+        public Dimension preferredLayoutSize(Container parent) {
             return Utilities.addInsets(text.getPreferredSize(), parent.getInsets());
         }
 
-        public Dimension minimumLayoutSize(final Container parent) {
+        public Dimension minimumLayoutSize(Container parent) {
             return Utilities.addInsets(text.getMinimumSize(), parent.getInsets());
         }
 
-        public void layoutContainer(final Container parent) {
+        public void layoutContainer(Container parent) {
             text.setBounds(0, 0, parent.getWidth(), parent.getHeight());
         }
 
@@ -235,12 +287,15 @@
             text.commitEdit();
         }
 
-        public void dismiss(final JSpinner spinner) {
+        public void dismiss(JSpinner spinner) {
             spinner.removeChangeListener(this);
         }
     }
 
+    @SuppressWarnings("unchecked")
     private static class SpinnerDateFormatter extends DateFormatter {
+        private static final long serialVersionUID = 1L;
+
         private SpinnerDateModel model;
 
         public SpinnerDateFormatter(final SimpleDateFormat format, final SpinnerDateModel model) {
@@ -248,22 +303,26 @@
             this.model = model;
         }
 
-        public void setMaximum(final Comparable max) {
+        @Override
+        public void setMaximum(Comparable max) {
             super.setMaximum(max);
             model.setEnd(max);
         }
 
-        public void setMinimum(final Comparable min) {
+        @Override
+        public void setMinimum(Comparable min) {
             super.setMinimum(min);
             model.setStart(min);
         }
 
+        @Override
         public Comparable getMaximum() {
             Comparable max = model.getEnd();
             super.setMaximum(max);
             return max;
         }
 
+        @Override
         public Comparable getMinimum() {
             Comparable min = model.getStart();
             super.setMinimum(min);
@@ -272,9 +331,11 @@
     }
 
     public static class DateEditor extends DefaultEditor {
+        private static final long serialVersionUID = 1L;
+
         private SimpleDateFormat format;
 
-        public DateEditor(final JSpinner spinner) {
+        public DateEditor(JSpinner spinner) {
             super(spinner);
             if (!(spinner.getModel() instanceof SpinnerDateModel)) {
                 throw new IllegalArgumentException("model not a SpinnerDateModel");
@@ -283,7 +344,7 @@
             initTextField();
         }
 
-        public DateEditor(final JSpinner spinner, final String dateFormatPattern) {
+        public DateEditor(JSpinner spinner, String dateFormatPattern) {
             super(spinner);
             if (!(spinner.getModel() instanceof SpinnerDateModel)) {
                 throw new IllegalArgumentException("model not a SpinnerDateModel");
@@ -297,7 +358,7 @@
         }
 
         public SpinnerDateModel getModel() {
-            return (SpinnerDateModel)this.getSpinner().getModel();
+            return (SpinnerDateModel) this.getSpinner().getModel();
         }
 
         private void initTextField() {
@@ -309,25 +370,26 @@
     }
 
     private static class SpinnerListFormatter extends AbstractFormatter {
+        private static final long serialVersionUID = 1L;
+
         private class ListFilter extends DocumentFilter {
             private JFormattedTextField textField;
 
-            public ListFilter(final JFormattedTextField textField) {
+            public ListFilter(JFormattedTextField textField) {
                 this.textField = textField;
             }
 
-            public void insertString(final FilterBypass fb, final int offset,
-                                     final String text, final AttributeSet attrs) throws BadLocationException {
+            @Override
+            public void insertString(FilterBypass fb, int offset, String text,
+                    AttributeSet attrs) throws BadLocationException {
                 super.insertString(fb, offset, text, attrs);
             }
 
-
-            public void replace(final FilterBypass fb, final int offset, final int length,
-                                final String text, final AttributeSet attrs) throws BadLocationException {
-
+            @Override
+            public void replace(FilterBypass fb, int offset, int length, String text,
+                    AttributeSet attrs) throws BadLocationException {
                 String str = textField.getText().substring(0, offset) + text;
                 String replace = findElementText(str);
-
                 if (!"".equals(replace)) {
                     fb.replace(0, textField.getText().length(), replace, attrs);
                     textField.setCaretPosition(offset + text.length());
@@ -337,7 +399,7 @@
                 }
             }
 
-            private String findElementText(final String text) {
+            private String findElementText(String text) {
                 Object findElement = findElement(text);
                 if (findElement == null) {
                     return "";
@@ -348,28 +410,31 @@
         }
 
         private SpinnerListModel model;
+
         private ListFilter filter;
 
-        public SpinnerListFormatter(final SpinnerListModel model, final JFormattedTextField textField) {
+        public SpinnerListFormatter(SpinnerListModel model, JFormattedTextField textField) {
             this.model = model;
             filter = new ListFilter(textField);
         }
 
-        public Object stringToValue(final String text) throws ParseException {
-//            Object result = findElement(text);
+        @Override
+        public Object stringToValue(String text) throws ParseException {
             return ("".equals(text)) ? null : findElement(text);
         }
 
-        public String valueToString(final Object value) throws ParseException {
+        @Override
+        public String valueToString(Object value) throws ParseException {
             return (value == null ? "" : value.toString());
         }
 
+        @Override
         protected DocumentFilter getDocumentFilter() {
             return filter;
         }
 
-        private Object findElement(final String text) {
-            List modelList = model.getList();
+        private Object findElement(String text) {
+            List<?> modelList = model.getList();
             for (int i = 0; i < modelList.size(); i++) {
                 Object obj = modelList.get(i);
                 if (obj != null && obj.toString().indexOf(text) == 0) {
@@ -381,48 +446,57 @@
     }
 
     public static class ListEditor extends DefaultEditor {
+        private static final long serialVersionUID = 1L;
 
-        public ListEditor(final JSpinner spinner) {
+        public ListEditor(JSpinner spinner) {
             super(spinner);
             if (!(spinner.getModel() instanceof SpinnerListModel)) {
                 throw new IllegalArgumentException("model not a SpinnerListModel");
             }
-            SpinnerListFormatter formatter = new SpinnerListFormatter(this.getModel(), this.getTextField());
+            SpinnerListFormatter formatter = new SpinnerListFormatter(this.getModel(), this
+                    .getTextField());
             JFormattedTextField textField = this.getTextField();
             textField.setFormatterFactory(new DefaultFormatterFactory(formatter));
             textField.setEditable(true);
         }
 
         public SpinnerListModel getModel() {
-            return (SpinnerListModel)this.getSpinner().getModel();
+            return (SpinnerListModel) this.getSpinner().getModel();
         }
     }
 
+    @SuppressWarnings("unchecked")
     private static class SpinnerNumberFormatter extends NumberFormatter {
+        private static final long serialVersionUID = 1L;
+
         private SpinnerNumberModel model;
 
-        public SpinnerNumberFormatter(final DecimalFormat format, final SpinnerNumberModel model) {
+        public SpinnerNumberFormatter(DecimalFormat format, SpinnerNumberModel model) {
             super(format);
             this.model = model;
             setValueClass(model.getValue().getClass());
         }
 
-        public void setMaximum(final Comparable max) {
+        @Override
+        public void setMaximum(Comparable max) {
             super.setMaximum(max);
             model.setMaximum(max);
         }
 
-        public void setMinimum(final Comparable min) {
+        @Override
+        public void setMinimum(Comparable min) {
             super.setMinimum(min);
             model.setMinimum(min);
         }
 
+        @Override
         public Comparable getMaximum() {
             Comparable max = model.getMaximum();
             super.setMaximum(max);
             return max;
         }
 
+        @Override
         public Comparable getMinimum() {
             Comparable min = model.getMinimum();
             super.setMinimum(min);
@@ -431,9 +505,11 @@
     }
 
     public static class NumberEditor extends DefaultEditor {
+        private static final long serialVersionUID = 1L;
+
         private DecimalFormat format;
 
-        public NumberEditor(final JSpinner spinner) {
+        public NumberEditor(JSpinner spinner) {
             super(spinner);
             if (!(spinner.getModel() instanceof SpinnerNumberModel)) {
                 throw new IllegalArgumentException("model not a SpinnerNumberModel");
@@ -442,7 +518,7 @@
             initTextField();
         }
 
-        public NumberEditor(final JSpinner spinner, final String decimalFormatPattern) {
+        public NumberEditor(JSpinner spinner, String decimalFormatPattern) {
             super(spinner);
             if (!(spinner.getModel() instanceof SpinnerNumberModel)) {
                 throw new IllegalArgumentException("model not a SpinnerNumberModel");
@@ -456,11 +532,12 @@
         }
 
         public SpinnerNumberModel getModel() {
-            return (SpinnerNumberModel)this.getSpinner().getModel();
+            return (SpinnerNumberModel) this.getSpinner().getModel();
         }
 
         private void initTextField() {
-            final SpinnerNumberFormatter numberFormatter = new SpinnerNumberFormatter(format, this.getModel());
+            SpinnerNumberFormatter numberFormatter = new SpinnerNumberFormatter(format, this
+                    .getModel());
             JFormattedTextField textField = this.getTextField();
             textField.setFormatterFactory(new DefaultFormatterFactory(numberFormatter));
             textField.setHorizontalAlignment(SwingConstants.RIGHT);
@@ -469,28 +546,38 @@
     }
 
     private class ModelChangeListener implements ChangeListener, Serializable {
-        public void stateChanged(final ChangeEvent e) {
+        private static final long serialVersionUID = 1L;
+
+        public void stateChanged(ChangeEvent e) {
             fireStateChanged();
         }
     }
 
     private static Action disabledAction = new AbstractAction() {
-        public void actionPerformed(final ActionEvent e) {
+        private static final long serialVersionUID = 1L;
+
+        public void actionPerformed(ActionEvent e) {
         }
 
+        @Override
         public boolean isEnabled() {
             return false;
         }
     };
 
     private static final String UI_CLASS_ID = "SpinnerUI";
+
     private SpinnerModel model;
+
     private boolean editorSet;
+
     private JComponent editor;
+
     private ChangeListener changeListener = new ModelChangeListener();
+
     private ChangeEvent changeEvent;
 
-    public JSpinner(final SpinnerModel model) {
+    public JSpinner(SpinnerModel model) {
         this.model = model;
         model.addChangeListener(changeListener);
         editor = createEditor(model);
@@ -502,22 +589,24 @@
     }
 
     public SpinnerUI getUI() {
-        return (SpinnerUI)ui;
+        return (SpinnerUI) ui;
     }
 
-    public void setUI(final SpinnerUI ui) {
+    public void setUI(SpinnerUI ui) {
         super.setUI(ui);
     }
 
+    @Override
     public String getUIClassID() {
         return UI_CLASS_ID;
     }
 
+    @Override
     public void updateUI() {
-        setUI((SpinnerUI)UIManager.getUI(this));
+        setUI((SpinnerUI) UIManager.getUI(this));
     }
 
-    protected JComponent createEditor(final SpinnerModel model) {
+    protected JComponent createEditor(SpinnerModel model) {
         if (model instanceof SpinnerNumberModel) {
             return new NumberEditor(this);
         }
@@ -530,7 +619,7 @@
         return new DefaultEditor(this);
     }
 
-    public void setModel(final SpinnerModel model) {
+    public void setModel(SpinnerModel model) {
         if (model == null) {
             throw new IllegalArgumentException("null model");
         }
@@ -553,7 +642,7 @@
         return model.getValue();
     }
 
-    public void setValue(final Object value) {
+    public void setValue(Object value) {
         model.setValue(value);
     }
 
@@ -565,20 +654,20 @@
         return model.getPreviousValue();
     }
 
-    public void addChangeListener(final ChangeListener listener) {
+    public void addChangeListener(ChangeListener listener) {
         listenerList.add(ChangeListener.class, listener);
     }
 
-    public void removeChangeListener(final ChangeListener listener) {
+    public void removeChangeListener(ChangeListener listener) {
         listenerList.remove(ChangeListener.class, listener);
     }
 
     public ChangeListener[] getChangeListeners() {
-        return (ChangeListener[])getListeners(ChangeListener.class);
+        return getListeners(ChangeListener.class);
     }
 
     protected void fireStateChanged() {
-        if(changeEvent == null) {
+        if (changeEvent == null) {
             changeEvent = new ChangeEvent(this);
         }
         ChangeListener[] listeners = getChangeListeners();
@@ -587,18 +676,16 @@
         }
     }
 
-    public void setEditor(final JComponent editor) {
+    public void setEditor(JComponent editor) {
         if (editor == null) {
             throw new IllegalArgumentException("null editor");
         }
-
         JComponent oldEditor = this.editor;
         if (oldEditor == editor) {
             return;
         }
-
         if (oldEditor instanceof DefaultEditor) {
-            DefaultEditor def = (DefaultEditor)oldEditor;
+            DefaultEditor def = (DefaultEditor) oldEditor;
             def.dismiss(this);
         }
         this.editor = editor;
@@ -612,10 +699,11 @@
 
     public void commitEdit() throws ParseException {
         if (editor instanceof DefaultEditor) {
-            ((DefaultEditor)editor).commitEdit();
+            ((DefaultEditor) editor).commitEdit();
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         if (accessibleContext == null) {
             accessibleContext = new AccessibleJSpinner();