Changeset 7015 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/projection/ListProjectionChoice.java
- Timestamp:
- 2014-04-27T17:34:22+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ListProjectionChoice.java
r6889 r7015 21 21 protected int index; // 0-based index 22 22 protected int defaultIndex; 23 protected Object[] entries;23 protected String[] entries; 24 24 protected String label; 25 25 … … 33 33 * @param defaultIndex the default index for the combo-box 34 34 */ 35 public ListProjectionChoice(String name, String id, Object[] entries, String label, int defaultIndex) {35 public ListProjectionChoice(String name, String id, String[] entries, String label, int defaultIndex) { 36 36 super(name, id); 37 37 this.entries = Utils.copyArray(entries); … … 47 47 * @param label a label shown left to the combo-box 48 48 */ 49 public ListProjectionChoice(String name, String id, Object[] entries, String label) {49 public ListProjectionChoice(String name, String id, String[] entries, String label) { 50 50 this(name, id, entries, label, 0); 51 51 } … … 54 54 * Convert 0-based index to preference value. 55 55 */ 56 protected abstract String indexToZone(int i ndex);56 protected abstract String indexToZone(int idx); 57 57 58 58 /** … … 67 67 zone = args.iterator().next(); 68 68 } 69 int i ndex;69 int idx; 70 70 if (zone == null) { 71 i ndex = defaultIndex;71 idx = defaultIndex; 72 72 } else { 73 i ndex = zoneToIndex(zone);74 if (i ndex < 0 || index >= entries.length) {75 i ndex = defaultIndex;73 idx = zoneToIndex(zone); 74 if (idx < 0 || idx >= entries.length) { 75 idx = defaultIndex; 76 76 } 77 77 } 78 this.index = i ndex;78 this.index = idx; 79 79 } 80 80 81 81 protected class CBPanel extends JPanel { 82 public JosmComboBox prefcb;82 public JosmComboBox<String> prefcb; 83 83 84 public CBPanel( Object[] entries, int initialIndex, String label, final ActionListener listener) {85 prefcb = new JosmComboBox (entries);84 public CBPanel(String[] entries, int initialIndex, String label, final ActionListener listener) { 85 prefcb = new JosmComboBox<>(entries); 86 86 87 87 prefcb.setSelectedIndex(initialIndex); … … 109 109 } 110 110 CBPanel p = (CBPanel) panel; 111 int i ndex = p.prefcb.getSelectedIndex();112 return Collections.singleton(indexToZone(i ndex));111 int idx = p.prefcb.getSelectedIndex(); 112 return Collections.singleton(indexToZone(idx)); 113 113 } 114 115 114 }
Note:
See TracChangeset
for help on using the changeset viewer.