< prev index next >

## src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.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.

    @@ -3606,17 +3606,17 @@
                         int size = HTML.getIntegerAttributeValue(attr,
                                                                  HTML.Attribute.SIZE,
                                                                  1);
                         boolean multiple = attr.getAttribute(HTML.Attribute.MULTIPLE) != null;
                         if ((size > 1) || multiple) {
    -                        OptionListModel<Option> m = new OptionListModel<Option>();
    +                        OptionListModel m = new OptionListModel();
                             if (multiple) {
                                 m.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                             }
                             selectModel = m;
                         } else {
    -                        selectModel = new OptionComboBoxModel<Option>();
    +                        selectModel = new OptionComboBoxModel();
                         }
                         attr.addAttribute(StyleConstants.ModelAttribute,
                                           selectModel);

                     }

    @@ -3624,20 +3624,18 @@
                     // build the element, unless this is an option.
                     if (t == HTML.Tag.OPTION) {
                         option = new Option(attr);

                         if (selectModel instanceof OptionListModel) {
    -                        @SuppressWarnings("unchecked")
    -                        OptionListModel<Option> m = (OptionListModel<Option>) selectModel;
    +                        OptionListModel m = (OptionListModel) selectModel;
                             m.addElement(option);
                             if (option.isSelected()) {
                                 m.addSelectionInterval(optionCount, optionCount);
                                 m.setInitialSelection(optionCount);
                             }
                         } else if (selectModel instanceof OptionComboBoxModel) {
    -                        @SuppressWarnings("unchecked")
    -                        OptionComboBoxModel<Option> m = (OptionComboBoxModel<Option>) selectModel;
    +                        OptionComboBoxModel m = (OptionComboBoxModel) selectModel;
                             m.addElement(option);
                             if (option.isSelected()) {
                                 m.setSelectedItem(option);
                                 m.setInitialSelection(option);
                             }

< prev index next >