diff options
| author | Bdale Garbee <bdale@gag.com> | 2014-06-15 17:47:41 -0600 |
|---|---|---|
| committer | Bdale Garbee <bdale@gag.com> | 2014-06-15 17:47:41 -0600 |
| commit | c5cfc0d6e507d093987741b6ffaf69ebb24caa4b (patch) | |
| tree | a75b83343939e96592ac07178f2011d82ea6ded8 /altosuilib/AltosUIConfigure.java | |
| parent | 1b3d07ede530fa40cb7257fb1725c969ba60e0f0 (diff) | |
| parent | 9ab3a1de95b705783c31a7e16447f52c10b6b480 (diff) | |
Merge branch 'branch-1.4' into debian
Diffstat (limited to 'altosuilib/AltosUIConfigure.java')
| -rw-r--r-- | altosuilib/AltosUIConfigure.java | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/altosuilib/AltosUIConfigure.java b/altosuilib/AltosUIConfigure.java index 9e72e403..920ed8e2 100644 --- a/altosuilib/AltosUIConfigure.java +++ b/altosuilib/AltosUIConfigure.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_1; +package org.altusmetrum.altosuilib_2; import java.awt.*; import java.awt.event.*; @@ -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); @@ -228,8 +229,8 @@ public class AltosUIConfigure public void add_frequencies() { } - public AltosUIConfigure(JFrame in_owner) { - super(in_owner, "Configure AltosUI", false); + public AltosUIConfigure(JFrame in_owner, String name, String label) { + super(in_owner, name, false); owner = in_owner; pane = getContentPane(); @@ -238,7 +239,7 @@ public class AltosUIConfigure row = 0; /* Nice label at the top */ - pane.add(new JLabel ("Configure AltOS UI"), + pane.add(new JLabel (label), constraints(0, 3)); row++; @@ -270,4 +271,8 @@ public class AltosUIConfigure setLocationRelativeTo(owner); setVisible(true); } + + public AltosUIConfigure(JFrame in_owner) { + this(in_owner, "Configure AltosUI", "Configure AltOS UI"); + } } |
