< prev index next >

src/com/sun/javatest/mrep/OptionsPane.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg

@@ -320,11 +320,11 @@
         /**
          * @param lst JList of checkboxes
          * @param p parent Panel
          * @param cardLayout The CardLayout for options
          */
-        SelectListener(JList lst, JPanel p, CardLayout cardLayout) {
+        SelectListener(JList<JCheckBox> lst, JPanel p, CardLayout cardLayout) {
             list = lst;
             listModel = list.getModel();
             lastSelected = listModel.getElementAt(0);
             panel = p;
             cards = cardLayout;

@@ -342,11 +342,11 @@
             }
         }
 
         public void valueChanged(ListSelectionEvent e) {
             int index = list.getSelectedIndex();
-            JCheckBox box = (JCheckBox) (listModel.getElementAt(index));
+            JCheckBox box = (listModel.getElementAt(index));
 
             if (lastSelected != box) {
                 cards.show(panel, box.getName());
                 lastSelected = box;
             }

@@ -377,11 +377,11 @@
                 }
             }
         }
 
         private void process(final int index) {
-            JCheckBox box = (JCheckBox) (listModel.getElementAt(index));
+            JCheckBox box = (listModel.getElementAt(index));
 
             if (lastSelected == box) {
                 box.doClick();
                 list.repaint(); // important!
                 enablePanel(box);

@@ -394,12 +394,12 @@
 
         public void keyPressed(KeyEvent e) {
         }
 
         Object lastSelected;
-        JList list;
-        ListModel listModel;
+        JList<JCheckBox> list;
+        ListModel<JCheckBox> listModel;
         JPanel panel;
         CardLayout cards;
         double emptyCBW = new JCheckBox("").getPreferredSize().getWidth() + 2;
     }
 

@@ -467,11 +467,11 @@
 
         private Set<Component> enabledComp;
     }
 
     private class CheckBoxListCellRenderer implements ListCellRenderer<JCheckBox> {
-        public Component getListCellRendererComponent(JList list, JCheckBox comp,
+        public Component getListCellRendererComponent(JList<? extends JCheckBox> list, JCheckBox comp,
                 int index, boolean isSelected, boolean cellHasFocus) {
             // assert: value is a JCheckBox
             if (isSelected) {
                 comp.setOpaque(true);
                 comp.setBackground(UIFactory.Colors.TEXT_HIGHLIGHT_COLOR.getValue());
< prev index next >