altosui/altosuilib: Cleanup -Xlint:unchecked warnings
authorKeith Packard <keithp@keithp.com>
Mon, 26 May 2014 03:47:49 +0000 (20:47 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 26 May 2014 03:52:37 +0000 (20:52 -0700)
Add parametric types to avoid unchecked warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosBTManage.java
altosui/AltosCSVUI.java
altosui/AltosChannelMenu.java
altosui/AltosConfigFreqUI.java
altosui/AltosConfigPyroUI.java
altosui/AltosConfigUI.java
altosui/AltosConfigureUI.java
altosui/AltosFlightUI.java
altosui/AltosScanUI.java
altosuilib/AltosDeviceDialog.java
altosuilib/AltosUIConfigure.java

index 1015f7c323774db278413bb61364c831c1f90f00..ad1c28b6e0bbd54ffc3e32beba8c8f96c787b761 100644 (file)
@@ -31,9 +31,9 @@ public class AltosBTManage extends AltosUIDialog implements ActionListener, Iter
        LinkedList<ActionListener> listeners;
        AltosBTKnown    bt_known;
 
        LinkedList<ActionListener> listeners;
        AltosBTKnown    bt_known;
 
-       class DeviceList extends JList implements Iterable<AltosBTDevice> {
-               LinkedList<AltosBTDevice> devices;
-               DefaultListModel        list_model;
+       class DeviceList extends JList<AltosBTDevice> implements Iterable<AltosBTDevice> {
+               LinkedList<AltosBTDevice>       devices;
+               DefaultListModel<AltosBTDevice> list_model;
 
                public void add (AltosBTDevice device) {
                        if (!devices.contains(device)) {
 
                public void add (AltosBTDevice device) {
                        if (!devices.contains(device)) {
@@ -86,16 +86,12 @@ public class AltosBTManage extends AltosUIDialog implements ActionListener, Iter
                }
 
                public java.util.List<AltosBTDevice> selected_list() throws InterruptedException {
                }
 
                public java.util.List<AltosBTDevice> selected_list() throws InterruptedException {
-                       java.util.LinkedList<AltosBTDevice> l = new java.util.LinkedList<AltosBTDevice>();
-                       Object[] a = getSelectedValues();
-                       for (int i = 0; i < a.length; i++)
-                               l.add((AltosBTDevice)a[i]);
-                       return l;
+                       return getSelectedValuesList();
                }
 
                public DeviceList() {
                        devices = new LinkedList<AltosBTDevice>();
                }
 
                public DeviceList() {
                        devices = new LinkedList<AltosBTDevice>();
-                       list_model = new DefaultListModel();
+                       list_model = new DefaultListModel<AltosBTDevice>();
                        setModel(list_model);
                        setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                        setLayoutOrientation(JList.HORIZONTAL_WRAP);
                        setModel(list_model);
                        setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                        setLayoutOrientation(JList.HORIZONTAL_WRAP);
index 05cabcdf4bcc68a4b6ccfe2e9d1ab7463ce3030a..95a8aeeaff9f64b22595bbd7cf08b708437e64f5 100644 (file)
@@ -30,7 +30,7 @@ public class AltosCSVUI
 {
        JFileChooser            csv_chooser;
        JPanel                  accessory;
 {
        JFileChooser            csv_chooser;
        JPanel                  accessory;
-       JComboBox               combo_box;
+       JComboBox<String>       combo_box;
        Iterable<AltosState>    states;
        AltosWriter             writer;
 
        Iterable<AltosState>    states;
        AltosWriter             writer;
 
@@ -73,7 +73,7 @@ public class AltosCSVUI
                c.gridy = 0;
                accessory.add(accessory_label, c);
 
                c.gridy = 0;
                accessory.add(accessory_label, c);
 
-               combo_box = new JComboBox(combo_box_items);
+               combo_box = new JComboBox<String>(combo_box_items);
                combo_box.addActionListener(this);
                c.gridx = 0;
                c.gridy = 1;
                combo_box.addActionListener(this);
                c.gridx = 0;
                c.gridy = 1;
index f90a11c0aa93a13b60eb3d761d01ee2a2b157ba9..382b6ae47809f9202521af7bb281a37bf6c66ae1 100644 (file)
@@ -20,7 +20,7 @@ package altosui;
 import java.awt.event.*;
 import javax.swing.*;
 
 import java.awt.event.*;
 import javax.swing.*;
 
-public class AltosChannelMenu extends JComboBox implements ActionListener {
+public class AltosChannelMenu extends JComboBox<String> implements ActionListener {
        int                             channel;
 
        public AltosChannelMenu(int current_channel) {
        int                             channel;
 
        public AltosChannelMenu(int current_channel) {
index 5877805791ec28ef7f81859a2dbb226fd2df6fc6..663782f0dc23906882770d341ea8dd6692aaafc7 100644 (file)
@@ -164,8 +164,8 @@ public class AltosConfigFreqUI extends AltosUIDialog implements ActionListener {
        Frame frame;
        LinkedList<ActionListener> listeners;
 
        Frame frame;
        LinkedList<ActionListener> listeners;
 
-       class FrequencyList extends JList {
-               DefaultListModel list_model;
+       class FrequencyList extends JList<AltosFrequency> {
+               DefaultListModel<AltosFrequency> list_model;
 
                public void add(AltosFrequency frequency) {
                        int i;
 
                public void add(AltosFrequency frequency) {
                        int i;
@@ -226,7 +226,7 @@ public class AltosConfigFreqUI extends AltosUIDialog implements ActionListener {
                }
 
                public FrequencyList(AltosFrequency[] in_frequencies) {
                }
 
                public FrequencyList(AltosFrequency[] in_frequencies) {
-                       list_model = new DefaultListModel();
+                       list_model = new DefaultListModel<AltosFrequency>();
                        setModel(list_model);
                        setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                        setLayoutOrientation(JList.HORIZONTAL_WRAP);
                        setModel(list_model);
                        setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                        setLayoutOrientation(JList.HORIZONTAL_WRAP);
index b667b15a18379529467f59d9ce7f09c135095949..cd42a3b0bef46797b000b7e6dd472684b072ead2 100644 (file)
@@ -50,7 +50,7 @@ public class AltosConfigPyroUI
                public int              flag;
                public JCheckBox        enable;
                public JTextField       value;
                public int              flag;
                public JCheckBox        enable;
                public JTextField       value;
-               public JComboBox        combo;
+               public JComboBox<String>        combo;
                AltosConfigPyroUI       ui;
                boolean                 setting;
 
                AltosConfigPyroUI       ui;
                boolean                 setting;
 
@@ -159,7 +159,7 @@ public class AltosConfigPyroUI
                                c.insets = il;
                                if ((flag & AltosPyro.pyro_state_value) != 0) {
                                        make_state_names();
                                c.insets = il;
                                if ((flag & AltosPyro.pyro_state_value) != 0) {
                                        make_state_names();
-                                       combo = new JComboBox(state_names);
+                                       combo = new JComboBox<String>(state_names);
                                        combo.addItemListener(this);
                                        pane.add(combo, c);
                                } else {
                                        combo.addItemListener(this);
                                        pane.add(combo, c);
                                } else {
index 6292f77870fd6c19a8cca0893572970dc111c9fb..7f4e1eb00280187b22664e53ea40d5eb2329994e 100644 (file)
@@ -29,98 +29,98 @@ public class AltosConfigUI
        implements ActionListener, ItemListener, DocumentListener, AltosConfigValues, AltosUnitsListener
 {
 
        implements ActionListener, ItemListener, DocumentListener, AltosConfigValues, AltosUnitsListener
 {
 
-       Container       pane;
-       JLabel          product_label;
-       JLabel          version_label;
-       JLabel          serial_label;
-       JLabel          main_deploy_label;
-       JLabel          apogee_delay_label;
-       JLabel          apogee_lockout_label;
-       JLabel          frequency_label;
-       JLabel          radio_calibration_label;
-       JLabel          radio_frequency_label;
-       JLabel          radio_enable_label;
-       JLabel          aprs_interval_label;
-       JLabel          flight_log_max_label;
-       JLabel          ignite_mode_label;
-       JLabel          pad_orientation_label;
-       JLabel          callsign_label;
-       JLabel          beep_label;
+       Container               pane;
+       JLabel                  product_label;
+       JLabel                  version_label;
+       JLabel                  serial_label;
+       JLabel                  main_deploy_label;
+       JLabel                  apogee_delay_label;
+       JLabel                  apogee_lockout_label;
+       JLabel                  frequency_label;
+       JLabel                  radio_calibration_label;
+       JLabel                  radio_frequency_label;
+       JLabel                  radio_enable_label;
+       JLabel                  aprs_interval_label;
+       JLabel                  flight_log_max_label;
+       JLabel                  ignite_mode_label;
+       JLabel                  pad_orientation_label;
+       JLabel                  callsign_label;
+       JLabel                  beep_label;
 
        public boolean          dirty;
 
 
        public boolean          dirty;
 
-       JFrame          owner;
-       JLabel          product_value;
-       JLabel          version_value;
-       JLabel          serial_value;
-       JComboBox       main_deploy_value;
-       JComboBox       apogee_delay_value;
-       JComboBox       apogee_lockout_value;
-       AltosFreqList   radio_frequency_value;
-       JTextField      radio_calibration_value;
-       JRadioButton    radio_enable_value;
-       JComboBox       aprs_interval_value;
-       JComboBox       flight_log_max_value;
-       JComboBox       ignite_mode_value;
-       JComboBox       pad_orientation_value;
-       JTextField      callsign_value;
-       JComboBox       beep_value;
-
-       JButton         pyro;
-
-       JButton         save;
-       JButton         reset;
-       JButton         reboot;
-       JButton         close;
-
-       AltosPyro[]     pyros;
-
-       ActionListener  listener;
-
-       static String[] main_deploy_values_m = {
+       JFrame                  owner;
+       JLabel                  product_value;
+       JLabel                  version_value;
+       JLabel                  serial_value;
+       JComboBox<String>       main_deploy_value;
+       JComboBox<String>       apogee_delay_value;
+       JComboBox<String>       apogee_lockout_value;
+       AltosFreqList           radio_frequency_value;
+       JTextField              radio_calibration_value;
+       JRadioButton            radio_enable_value;
+       JComboBox<String>       aprs_interval_value;
+       JComboBox<String>       flight_log_max_value;
+       JComboBox<String>       ignite_mode_value;
+       JComboBox<String>       pad_orientation_value;
+       JTextField              callsign_value;
+       JComboBox<String>       beep_value;
+
+       JButton                 pyro;
+
+       JButton                 save;
+       JButton                 reset;
+       JButton                 reboot;
+       JButton                 close;
+
+       AltosPyro[]             pyros;
+
+       ActionListener          listener;
+
+       static String[]         main_deploy_values_m = {
                "100", "150", "200", "250", "300", "350",
                "400", "450", "500"
        };
 
                "100", "150", "200", "250", "300", "350",
                "400", "450", "500"
        };
 
-       static String[] main_deploy_values_ft = {
+       static String[]         main_deploy_values_ft = {
                "250", "500", "750", "1000", "1250", "1500",
                "1750", "2000"
        };
 
                "250", "500", "750", "1000", "1250", "1500",
                "1750", "2000"
        };
 
-       static String[] apogee_delay_values = {
+       static String[]         apogee_delay_values = {
                "0", "1", "2", "3", "4", "5"
        };
 
                "0", "1", "2", "3", "4", "5"
        };
 
-       static String[] apogee_lockout_values = {
+       static String[]         apogee_lockout_values = {
                "0", "5", "10", "15", "20"
        };
 
                "0", "5", "10", "15", "20"
        };
 
-       static String[] flight_log_max_values = {
+       static String[]         flight_log_max_values = {
                "64", "128", "192", "256", "320",
                "384", "448", "512", "576", "640",
                "704", "768", "832", "896", "960",
        };
 
                "64", "128", "192", "256", "320",
                "384", "448", "512", "576", "640",
                "704", "768", "832", "896", "960",
        };
 
-       static String[] ignite_mode_values = {
+       static String[]         ignite_mode_values = {
                "Dual Deploy",
                "Redundant Apogee",
                "Redundant Main",
        };
 
                "Dual Deploy",
                "Redundant Apogee",
                "Redundant Main",
        };
 
-       static String[] aprs_interval_values = {
+       static String[]         aprs_interval_values = {
                "Disabled",
                "2",
                "5",
                "10"
        };
 
                "Disabled",
                "2",
                "5",
                "10"
        };
 
-       static String[] beep_values = {
+       static String[]         beep_values = {
                "3750",
                "4000",
                "4250",
        };
 
                "3750",
                "4000",
                "4250",
        };
 
-       static String[] pad_orientation_values = {
+       static String[]         pad_orientation_values = {
                "Antenna Up",
                "Antenna Down",
        };
                "Antenna Up",
                "Antenna Down",
        };
@@ -319,7 +319,7 @@ public class AltosConfigUI
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
-               main_deploy_value = new JComboBox(main_deploy_values());
+               main_deploy_value = new JComboBox<String>(main_deploy_values());
                main_deploy_value.setEditable(true);
                main_deploy_value.addItemListener(this);
                pane.add(main_deploy_value, c);
                main_deploy_value.setEditable(true);
                main_deploy_value.addItemListener(this);
                pane.add(main_deploy_value, c);
@@ -345,7 +345,7 @@ public class AltosConfigUI
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
-               apogee_delay_value = new JComboBox(apogee_delay_values);
+               apogee_delay_value = new JComboBox<String>(apogee_delay_values);
                apogee_delay_value.setEditable(true);
                apogee_delay_value.addItemListener(this);
                pane.add(apogee_delay_value, c);
                apogee_delay_value.setEditable(true);
                apogee_delay_value.addItemListener(this);
                pane.add(apogee_delay_value, c);
@@ -371,7 +371,7 @@ public class AltosConfigUI
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
-               apogee_lockout_value = new JComboBox(apogee_lockout_values);
+               apogee_lockout_value = new JComboBox<String>(apogee_lockout_values);
                apogee_lockout_value.setEditable(true);
                apogee_lockout_value.addItemListener(this);
                pane.add(apogee_lockout_value, c);
                apogee_lockout_value.setEditable(true);
                apogee_lockout_value.addItemListener(this);
                pane.add(apogee_lockout_value, c);
@@ -474,7 +474,7 @@ public class AltosConfigUI
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
-               aprs_interval_value = new JComboBox(aprs_interval_values);
+               aprs_interval_value = new JComboBox<String>(aprs_interval_values);
                aprs_interval_value.setEditable(true);
                aprs_interval_value.addItemListener(this);
                pane.add(aprs_interval_value, c);
                aprs_interval_value.setEditable(true);
                aprs_interval_value.addItemListener(this);
                pane.add(aprs_interval_value, c);
@@ -525,7 +525,7 @@ public class AltosConfigUI
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
-               flight_log_max_value = new JComboBox(flight_log_max_values);
+               flight_log_max_value = new JComboBox<String>(flight_log_max_values);
                flight_log_max_value.setEditable(true);
                flight_log_max_value.addItemListener(this);
                pane.add(flight_log_max_value, c);
                flight_log_max_value.setEditable(true);
                flight_log_max_value.addItemListener(this);
                pane.add(flight_log_max_value, c);
@@ -551,7 +551,7 @@ public class AltosConfigUI
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
-               ignite_mode_value = new JComboBox(ignite_mode_values);
+               ignite_mode_value = new JComboBox<String>(ignite_mode_values);
                ignite_mode_value.setEditable(false);
                ignite_mode_value.addItemListener(this);
                pane.add(ignite_mode_value, c);
                ignite_mode_value.setEditable(false);
                ignite_mode_value.addItemListener(this);
                pane.add(ignite_mode_value, c);
@@ -577,7 +577,7 @@ public class AltosConfigUI
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
-               pad_orientation_value = new JComboBox(pad_orientation_values);
+               pad_orientation_value = new JComboBox<String>(pad_orientation_values);
                pad_orientation_value.setEditable(false);
                pad_orientation_value.addItemListener(this);
                pane.add(pad_orientation_value, c);
                pad_orientation_value.setEditable(false);
                pad_orientation_value.addItemListener(this);
                pane.add(pad_orientation_value, c);
@@ -603,7 +603,7 @@ public class AltosConfigUI
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
                c.anchor = GridBagConstraints.LINE_START;
                c.insets = ir;
                c.ipady = 5;
-               beep_value = new JComboBox(beep_values);
+               beep_value = new JComboBox<String>(beep_values);
                beep_value.setEditable(true);
                beep_value.addItemListener(this);
                pane.add(beep_value, c);
                beep_value.setEditable(true);
                beep_value.addItemListener(this);
                pane.add(beep_value, c);
index 631c188dddd5063d8c3cce556224d4836f8a0f63..80876959600bb788458505c2611aa6032c8d15ef 100644 (file)
@@ -31,7 +31,7 @@ public class AltosConfigureUI
        AltosVoice      voice;
 
        public JTextField       callsign_value;
        AltosVoice      voice;
 
        public JTextField       callsign_value;
-       public JComboBox        position_value;
+       public JComboBox<String>        position_value;
 
        /* DocumentListener interface methods */
        public void insertUpdate(DocumentEvent e) {
 
        /* DocumentListener interface methods */
        public void insertUpdate(DocumentEvent e) {
@@ -127,7 +127,7 @@ public class AltosConfigureUI
        public void add_position() {
                pane.add(new JLabel ("Menu position"), constraints(0, 1));
 
        public void add_position() {
                pane.add(new JLabel ("Menu position"), constraints(0, 1));
 
-               position_value = new JComboBox (position_names);
+               position_value = new JComboBox<String>(position_names);
                position_value.setMaximumRowCount(position_names.length);
                int position = AltosUIPreferences.position();
                position_value.setSelectedIndex(position);
                position_value.setMaximumRowCount(position_names.length);
                int position = AltosUIPreferences.position();
                position_value.setSelectedIndex(position);
index 0d21d296f66558a7a237238b5dadfaa1c84b08a4..b31de12c858ee6cf0f6c3a5ec10ce8051ef77bfc 100644 (file)
@@ -179,7 +179,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, A
 
        Container       bag;
        AltosFreqList   frequencies;
 
        Container       bag;
        AltosFreqList   frequencies;
-       JComboBox       telemetries;
+       JComboBox<String>       telemetries;
        JLabel          telemetry;
 
        ActionListener  show_timer;
        JLabel          telemetry;
 
        ActionListener  show_timer;
@@ -225,7 +225,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, A
 
                        // Telemetry format menu
                        if (reader.supports_telemetry(Altos.ao_telemetry_standard)) {
 
                        // Telemetry format menu
                        if (reader.supports_telemetry(Altos.ao_telemetry_standard)) {
-                               telemetries = new JComboBox();
+                               telemetries = new JComboBox<String>();
                                for (int i = 1; i <= Altos.ao_telemetry_max; i++)
                                        telemetries.addItem(Altos.telemetry_name(i));
                                int telemetry = AltosPreferences.telemetry(serial);
                                for (int i = 1; i <= Altos.ao_telemetry_max; i++)
                                        telemetries.addItem(Altos.telemetry_name(i));
                                int telemetry = AltosPreferences.telemetry(serial);
index 419fe9577acc4632ef4b710552277f1583acf994..5cc74a7796b6a91cad6068b1d6ff3f0f3938b05d 100644 (file)
@@ -75,7 +75,7 @@ class AltosScanResult {
        }
 }
 
        }
 }
 
-class AltosScanResults extends LinkedList<AltosScanResult> implements ListModel {
+class AltosScanResults extends LinkedList<AltosScanResult> implements ListModel<AltosScanResult> {
 
        LinkedList<ListDataListener>    listeners = new LinkedList<ListDataListener>();
 
 
        LinkedList<ListDataListener>    listeners = new LinkedList<ListDataListener>();
 
@@ -129,7 +129,7 @@ public class AltosScanUI
        AltosDevice                     device;
        AltosConfigData                 config_data;
        AltosTelemetryReader            reader;
        AltosDevice                     device;
        AltosConfigData                 config_data;
        AltosTelemetryReader            reader;
-       private JList                   list;
+       private JList<AltosScanResult>  list;
        private JLabel                  scanning_label;
        private JLabel                  frequency_label;
        private JLabel                  telemetry_label;
        private JLabel                  scanning_label;
        private JLabel                  frequency_label;
        private JLabel                  telemetry_label;
@@ -435,7 +435,7 @@ public class AltosScanUI
 
                int     y_offset = 3 + (Altos.ao_telemetry_max - Altos.ao_telemetry_min + 1);
 
 
                int     y_offset = 3 + (Altos.ao_telemetry_max - Altos.ao_telemetry_min + 1);
 
-               list = new JList(results) {
+               list = new JList<AltosScanResult>(results) {
                                //Subclass JList to workaround bug 4832765, which can cause the
                                //scroll pane to not let the user easily scroll up to the beginning
                                //of the list.  An alternative would be to set the unitIncrement
                                //Subclass JList to workaround bug 4832765, which can cause the
                                //scroll pane to not let the user easily scroll up to the beginning
                                //of the list.  An alternative would be to set the unitIncrement
@@ -548,4 +548,4 @@ public class AltosScanUI
 
                setVisible(true);
        }
 
                setVisible(true);
        }
-}
\ No newline at end of file
+}
index 0a3ddb7bf034482dc518ec57795c60e990bdffef..7fb23e137002c8b3b665f40d39e7755e882ca7c4 100644 (file)
@@ -23,13 +23,13 @@ import java.awt.event.*;
 
 public abstract class AltosDeviceDialog extends AltosUIDialog implements ActionListener {
 
 
 public abstract class AltosDeviceDialog extends AltosUIDialog implements ActionListener {
 
-       private AltosDevice     value;
-       private JList           list;
-       private JButton         cancel_button;
-       private JButton         select_button;
-       public Frame            frame;
-       public int              product;
-       public JPanel           buttonPane;
+       private AltosDevice             value;
+       private JList<AltosDevice>      list;
+       private JButton                 cancel_button;
+       private JButton                 select_button;
+       public Frame                    frame;
+       public int                      product;
+       public JPanel                   buttonPane;
 
        public AltosDevice getValue() {
                return value;
 
        public AltosDevice getValue() {
                return value;
@@ -65,7 +65,7 @@ public abstract class AltosDeviceDialog extends AltosUIDialog implements ActionL
                        select_button.setEnabled(false);
                getRootPane().setDefaultButton(select_button);
 
                        select_button.setEnabled(false);
                getRootPane().setDefaultButton(select_button);
 
-               list = new JList(devices) {
+               list = new JList<AltosDevice>(devices) {
                                //Subclass JList to workaround bug 4832765, which can cause the
                                //scroll pane to not let the user easily scroll up to the beginning
                                //of the list.  An alternative would be to set the unitIncrement
                                //Subclass JList to workaround bug 4832765, which can cause the
                                //scroll pane to not let the user easily scroll up to the beginning
                                //of the list.  An alternative would be to set the unitIncrement
index 9e72e403a877abf8c5677588530f110a08291836..153eb8eec2558d5339ee58f336836426c28d9e15 100644 (file)
@@ -23,10 +23,10 @@ import java.beans.*;
 import javax.swing.*;
 import javax.swing.event.*;
 
 import javax.swing.*;
 import javax.swing.event.*;
 
-class DelegatingRenderer implements ListCellRenderer {
+class DelegatingRenderer implements ListCellRenderer<Object> {
 
        // ...
 
        // ...
-       public static void install(JComboBox comboBox) {
+       public static void install(JComboBox<Object> comboBox) {
                DelegatingRenderer renderer = new DelegatingRenderer(comboBox);
                renderer.initialise();
                comboBox.setRenderer(renderer);
                DelegatingRenderer renderer = new DelegatingRenderer(comboBox);
                renderer.initialise();
                comboBox.setRenderer(renderer);
@@ -36,7 +36,7 @@ class DelegatingRenderer implements ListCellRenderer {
        private final JComboBox comboBox;
 
        // ...
        private final JComboBox comboBox;
 
        // ...
-       private ListCellRenderer delegate;
+       private ListCellRenderer<? super Object> delegate;
 
        // ...
        private DelegatingRenderer(JComboBox comboBox) {
 
        // ...
        private DelegatingRenderer(JComboBox comboBox) {
@@ -45,21 +45,22 @@ class DelegatingRenderer implements ListCellRenderer {
 
        // ...
        private void initialise() {
 
        // ...
        private void initialise() {
-               delegate = new JComboBox().getRenderer();
+               JComboBox<Object> c = new JComboBox<Object>();
+               delegate = c.getRenderer();
                comboBox.addPropertyChangeListener("UI", new PropertyChangeListener() {
 
                                public void propertyChange(PropertyChangeEvent evt) {
                comboBox.addPropertyChangeListener("UI", new PropertyChangeListener() {
 
                                public void propertyChange(PropertyChangeEvent evt) {
-                                       delegate = new JComboBox().getRenderer();
+                                       delegate = new JComboBox<Object>().getRenderer();
                                }
                        });
        }
 
        // ...
                                }
                        });
        }
 
        // ...
-       public Component getListCellRendererComponent(JList list,
+       public Component getListCellRendererComponent(JList<?> list,
                                                      Object value, int index, boolean isSelected, boolean cellHasFocus) {
 
                return delegate.getListCellRendererComponent(list,
                                                      Object value, int index, boolean isSelected, boolean cellHasFocus) {
 
                return delegate.getListCellRendererComponent(list,
-                                                            ((UIManager.LookAndFeelInfo) value).getName(),
+                                                            ((UIManager.LookAndFeelInfo)value).getName(),
                                                             index, isSelected, cellHasFocus);
        }
 }
                                                             index, isSelected, cellHasFocus);
        }
 }
@@ -139,7 +140,7 @@ public class AltosUIConfigure
                /* Font size setting */
                pane.add(new JLabel("Font size"), constraints(0, 1));
 
                /* Font size setting */
                pane.add(new JLabel("Font size"), constraints(0, 1));
 
-               final JComboBox font_size_value = new JComboBox(font_size_names);
+               final JComboBox<String> font_size_value = new JComboBox<String>(font_size_names);
                int font_size = AltosUIPreferences.font_size();
                font_size_value.setSelectedIndex(font_size - AltosUILib.font_size_small);
                font_size_value.addActionListener(new ActionListener() {
                int font_size = AltosUIPreferences.font_size();
                font_size_value.setSelectedIndex(font_size - AltosUILib.font_size_small);
                font_size_value.addActionListener(new ActionListener() {
@@ -181,7 +182,7 @@ public class AltosUIConfigure
 
                final UIManager.LookAndFeelInfo[] look_and_feels = UIManager.getInstalledLookAndFeels();
 
 
                final UIManager.LookAndFeelInfo[] look_and_feels = UIManager.getInstalledLookAndFeels();
 
-               final JComboBox look_and_feel_value = new JComboBox(look_and_feels);
+               final JComboBox<Object> look_and_feel_value = new JComboBox<Object>(look_and_feels);
 
                DelegatingRenderer.install(look_and_feel_value);
 
 
                DelegatingRenderer.install(look_and_feel_value);