diff options
| -rw-r--r-- | altosui/AltosBTManage.java | 14 | ||||
| -rw-r--r-- | altosui/AltosCSVUI.java | 4 | ||||
| -rw-r--r-- | altosui/AltosChannelMenu.java | 2 | ||||
| -rw-r--r-- | altosui/AltosConfigFreqUI.java | 6 | ||||
| -rw-r--r-- | altosui/AltosConfigPyroUI.java | 4 | ||||
| -rw-r--r-- | altosui/AltosConfigUI.java | 124 | ||||
| -rw-r--r-- | altosui/AltosConfigureUI.java | 4 | ||||
| -rw-r--r-- | altosui/AltosFlightUI.java | 4 | ||||
| -rw-r--r-- | altosui/AltosScanUI.java | 8 | ||||
| -rw-r--r-- | altosuilib/AltosDeviceDialog.java | 16 | ||||
| -rw-r--r-- | altosuilib/AltosUIConfigure.java | 19 | 
11 files changed, 101 insertions, 104 deletions
| diff --git a/altosui/AltosBTManage.java b/altosui/AltosBTManage.java index 1015f7c3..ad1c28b6 100644 --- a/altosui/AltosBTManage.java +++ b/altosui/AltosBTManage.java @@ -31,9 +31,9 @@ public class AltosBTManage extends AltosUIDialog implements ActionListener, Iter  	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)) { @@ -86,16 +86,12 @@ public class AltosBTManage extends AltosUIDialog implements ActionListener, Iter  		}  		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>(); -			list_model = new DefaultListModel(); +			list_model = new DefaultListModel<AltosBTDevice>();  			setModel(list_model);  			setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);  			setLayoutOrientation(JList.HORIZONTAL_WRAP); diff --git a/altosui/AltosCSVUI.java b/altosui/AltosCSVUI.java index 05cabcdf..95a8aeea 100644 --- a/altosui/AltosCSVUI.java +++ b/altosui/AltosCSVUI.java @@ -30,7 +30,7 @@ public class AltosCSVUI  {  	JFileChooser		csv_chooser;  	JPanel			accessory; -	JComboBox		combo_box; +	JComboBox<String>	combo_box;  	Iterable<AltosState>	states;  	AltosWriter		writer; @@ -73,7 +73,7 @@ public class AltosCSVUI  		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; diff --git a/altosui/AltosChannelMenu.java b/altosui/AltosChannelMenu.java index f90a11c0..382b6ae4 100644 --- a/altosui/AltosChannelMenu.java +++ b/altosui/AltosChannelMenu.java @@ -20,7 +20,7 @@ package altosui;  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) { diff --git a/altosui/AltosConfigFreqUI.java b/altosui/AltosConfigFreqUI.java index 58778057..663782f0 100644 --- a/altosui/AltosConfigFreqUI.java +++ b/altosui/AltosConfigFreqUI.java @@ -164,8 +164,8 @@ public class AltosConfigFreqUI extends AltosUIDialog implements ActionListener {  	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; @@ -226,7 +226,7 @@ public class AltosConfigFreqUI extends AltosUIDialog implements ActionListener {  		}  		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); diff --git a/altosui/AltosConfigPyroUI.java b/altosui/AltosConfigPyroUI.java index b667b15a..cd42a3b0 100644 --- a/altosui/AltosConfigPyroUI.java +++ b/altosui/AltosConfigPyroUI.java @@ -50,7 +50,7 @@ public class AltosConfigPyroUI  		public int		flag;  		public JCheckBox	enable;  		public JTextField	value; -		public JComboBox	combo; +		public JComboBox<String>	combo;  		AltosConfigPyroUI	ui;  		boolean			setting; @@ -159,7 +159,7 @@ public class AltosConfigPyroUI  				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 { diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 6292f778..7f4e1eb0 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -29,98 +29,98 @@ public class AltosConfigUI  	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; -	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"  	}; -	static String[] main_deploy_values_ft = { +	static String[] 	main_deploy_values_ft = {  		"250", "500", "750", "1000", "1250", "1500",  		"1750", "2000"  	}; -	static String[] apogee_delay_values = { +	static String[] 	apogee_delay_values = {  		"0", "1", "2", "3", "4", "5"  	}; -	static String[] apogee_lockout_values = { +	static String[] 	apogee_lockout_values = {  		"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",  	}; -	static String[] ignite_mode_values = { +	static String[] 	ignite_mode_values = {  		"Dual Deploy",  		"Redundant Apogee",  		"Redundant Main",  	}; -	static String[] aprs_interval_values = { +	static String[] 	aprs_interval_values = {  		"Disabled",  		"2",  		"5",  		"10"  	}; -	static String[] beep_values = { +	static String[] 	beep_values = {  		"3750",  		"4000",  		"4250",  	}; -	static String[] pad_orientation_values = { +	static String[] 	pad_orientation_values = {  		"Antenna Up",  		"Antenna Down",  	}; @@ -319,7 +319,7 @@ public class AltosConfigUI  		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); @@ -345,7 +345,7 @@ public class AltosConfigUI  		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); @@ -371,7 +371,7 @@ public class AltosConfigUI  		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); @@ -474,7 +474,7 @@ public class AltosConfigUI  		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); @@ -525,7 +525,7 @@ public class AltosConfigUI  		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); @@ -551,7 +551,7 @@ public class AltosConfigUI  		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); @@ -577,7 +577,7 @@ public class AltosConfigUI  		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); @@ -603,7 +603,7 @@ public class AltosConfigUI  		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); diff --git a/altosui/AltosConfigureUI.java b/altosui/AltosConfigureUI.java index 631c188d..80876959 100644 --- a/altosui/AltosConfigureUI.java +++ b/altosui/AltosConfigureUI.java @@ -31,7 +31,7 @@ public class AltosConfigureUI  	AltosVoice	voice;  	public JTextField	callsign_value; -	public JComboBox	position_value; +	public JComboBox<String>	position_value;  	/* 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)); -		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); diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index 0d21d296..b31de12c 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -179,7 +179,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, A  	Container	bag;  	AltosFreqList	frequencies; -	JComboBox	telemetries; +	JComboBox<String>	telemetries;  	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)) { -				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); diff --git a/altosui/AltosScanUI.java b/altosui/AltosScanUI.java index 419fe957..5cc74a77 100644 --- a/altosui/AltosScanUI.java +++ b/altosui/AltosScanUI.java @@ -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>(); @@ -129,7 +129,7 @@ public class AltosScanUI  	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; @@ -435,7 +435,7 @@ public class AltosScanUI  		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 @@ -548,4 +548,4 @@ public class AltosScanUI  		setVisible(true);  	} -}
\ No newline at end of file +} 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); | 
