< prev index next >

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

Print this page

    rev 48358 : 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.

    @@ -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,13 @@
          * @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 {
    +    public OptionListModel clone() throws CloneNotSupportedException {
             @SuppressWarnings("unchecked")
    -        OptionListModel<E> clone = (OptionListModel)super.clone();
    +        OptionListModel clone = (OptionListModel)super.clone();
             clone.value = (BitSet)value.clone();
             clone.listenerList = new EventListenerList();
             return clone;
         }

< prev index next >