< prev index next >

## src/java.desktop/share/classes/javax/swing/text/html/OptionListModel.java

Print this page

    rev 48858 : Work in progress for JDK-6303622
    Use generic in Swing components like JComboBox
    1. Added generic return type and parameter type for JComboBox.
    2. Modified JList related classes as well.
    3. Reverted the changes made to "getSelectedValues" as suggested by Joe.
    4. Modified files that were failing on Linux and Mac as well.

    @@ -41,11 +41,11 @@
      * accurate reset, if the user requests a reset of the form.
      *
      * @author Sunita Mani
      */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
    -class OptionListModel<E> extends DefaultListModel<E> implements ListSelectionModel, Serializable {
    +class OptionListModel extends DefaultListModel<Option> implements ListSelectionModel, Serializable {

         private static final int MIN = -1;
         private static final int MAX = Integer.MAX_VALUE;
         private int selectionMode = SINGLE_SELECTION;

    @@ -174,11 +174,11 @@
         private void set(int r) {
             if (value.get(r)) {
                 return;
             }
             value.set(r);
    -        Option option = (Option)get(r);
    +        Option option = get(r);
             option.setSelection(true);
             markAsDirty(r);

             // Update minimum and maximum indices
             minIndex = Math.min(minIndex, r);

    @@ -189,11 +189,11 @@
         private void clear(int r) {
             if (!value.get(r)) {
                 return;
             }
             value.clear(r);
    -        Option option = (Option)get(r);
    +        Option option = get(r);
             option.setSelection(false);
             markAsDirty(r);

             // Update minimum and maximum indices
             /*

    @@ -466,13 +466,12 @@
          * @return a clone of the receiver
          * @exception CloneNotSupportedException if the receiver does not
          *    both (a) implement the <code>Cloneable</code> interface
          *    and (b) define a <code>clone</code> method
          */
    -    public Object clone() throws CloneNotSupportedException {
    -        @SuppressWarnings("unchecked")
    -        OptionListModel<E> clone = (OptionListModel)super.clone();
    +    public OptionListModel clone() throws CloneNotSupportedException {
    +        OptionListModel clone = (OptionListModel)super.clone();
             clone.value = (BitSet)value.clone();
             clone.listenerList = new EventListenerList();
             return clone;
         }

< prev index next >