diff options
author | Keith Packard <keithp@keithp.com> | 2014-05-25 20:47:49 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-05-25 20:52:37 -0700 |
commit | 4ac7797d3efb9cc2d9fae88519f55e40b1050224 (patch) | |
tree | 5348eaabf15e552eb3b4f37dfee4190d4cc05979 /altosuilib | |
parent | b60a3689910731d9bdb8a431a3dcc9e99f961b35 (diff) |
altosui/altosuilib: Cleanup -Xlint:unchecked warnings
Add parametric types to avoid unchecked warnings.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosuilib')
-rw-r--r-- | altosuilib/AltosDeviceDialog.java | 16 | ||||
-rw-r--r-- | altosuilib/AltosUIConfigure.java | 19 |
2 files changed, 18 insertions, 17 deletions
diff --git a/altosuilib/AltosDeviceDialog.java b/altosuilib/AltosDeviceDialog.java index 0a3ddb7b..7fb23e13 100644 --- a/altosuilib/AltosDeviceDialog.java +++ b/altosuilib/AltosDeviceDialog.java @@ -23,13 +23,13 @@ import java.awt.event.*; 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; @@ -65,7 +65,7 @@ public abstract class AltosDeviceDialog extends AltosUIDialog implements ActionL 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 diff --git a/altosuilib/AltosUIConfigure.java b/altosuilib/AltosUIConfigure.java index 9e72e403..153eb8ee 100644 --- a/altosuilib/AltosUIConfigure.java +++ b/altosuilib/AltosUIConfigure.java @@ -23,10 +23,10 @@ import java.beans.*; 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); @@ -36,7 +36,7 @@ class DelegatingRenderer implements ListCellRenderer { private final JComboBox comboBox; // ... - private ListCellRenderer delegate; + private ListCellRenderer<? super Object> delegate; // ... private DelegatingRenderer(JComboBox comboBox) { @@ -45,21 +45,22 @@ class DelegatingRenderer implements ListCellRenderer { // ... 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) { - 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, - ((UIManager.LookAndFeelInfo) value).getName(), + ((UIManager.LookAndFeelInfo)value).getName(), index, isSelected, cellHasFocus); } } @@ -139,7 +140,7 @@ public class AltosUIConfigure /* 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() { @@ -181,7 +182,7 @@ public class AltosUIConfigure 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); |