summaryrefslogtreecommitdiff
path: root/altosuilib/AltosUIConfigure.java
diff options
context:
space:
mode:
Diffstat (limited to 'altosuilib/AltosUIConfigure.java')
-rw-r--r--altosuilib/AltosUIConfigure.java31
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");
+ }
}