Changeset 30057 in osm for applications/editors/josm/plugins/buildings_tools
- Timestamp:
- 2013-11-17T20:09:32+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AddressDialog.java
r30045 r30057 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Choice;7 6 import java.text.NumberFormat; 8 7 import java.text.ParseException; 9 8 9 import javax.swing.JSpinner; 10 10 import javax.swing.JTextField; 11 import javax.swing.SpinnerNumberModel; 11 12 12 13 @SuppressWarnings("serial") 13 14 public class AddressDialog extends MyDialog { 14 15 private static String lhousenum, lstreetname; 15 private static boolean inc = true;16 private static int inc = 0; 16 17 private JTextField housenum = new JTextField(); 17 18 private JTextField streetname = new JTextField(); 18 private Choice cincdec = new Choice();19 private JSpinner incSpinner; 19 20 20 21 public AddressDialog() { … … 26 27 streetname.setText(lstreetname); 27 28 28 cincdec.add(tr("Increment"));29 cincdec.add(tr("Decrement"));30 cincdec.select(inc ? 0 : 1);31 addLabelled(tr("Number s:"), cincdec);29 SpinnerNumberModel inc_model = new SpinnerNumberModel(0, Integer.MIN_VALUE, Integer.MAX_VALUE, 1); 30 incSpinner = new JSpinner(inc_model); 31 incSpinner.setValue(inc); 32 addLabelled(tr("Number increment:"), incSpinner); 32 33 33 34 setContent(panel); … … 39 40 return ""; 40 41 try { 41 Integer num = NumberFormat.getInstance().parse(lhousenum).intValue(); 42 if (inc) 43 num = num + 2; 44 else 45 num = num - 2; 42 Integer num = NumberFormat.getInstance().parse(lhousenum).intValue() + inc; 46 43 return num.toString(); 47 44 } catch (ParseException e) { … … 53 50 lhousenum = housenum.getText(); 54 51 lstreetname = streetname.getText(); 55 inc = cincdec.getSelectedIndex() == 0;52 inc = (Integer) incSpinner.getValue(); 56 53 } 57 54
Note:
See TracChangeset
for help on using the changeset viewer.