Changeset 28008 in osm for applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
- Timestamp:
- 2012-03-06T21:32:44+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
r27986 r28008 14 14 * @author zverik 15 15 */ 16 public class OffsetDialog extends JDialog {16 public class OffsetDialog extends JDialog implements ActionListener { 17 17 private List<ImageryOffsetBase> offsets; 18 private intselectedOffset;18 private ImageryOffsetBase selectedOffset; 19 19 20 20 public OffsetDialog( List<ImageryOffsetBase> offsets ) { … … 27 27 JPanel buttonPanel = new JPanel(new GridLayout(offsets.size() + 1, 1)); 28 28 for( ImageryOffsetBase offset : offsets ) { 29 buttonPanel.add(new OffsetDialogButton(offset)); 29 OffsetDialogButton button = new OffsetDialogButton(offset); 30 button.addActionListener(this); 31 buttonPanel.add(button); 30 32 } 31 33 JButton cancelButton = new JButton("Cancel"); 32 cancelButton.addActionListener(new ActionListener() { 33 public void actionPerformed(ActionEvent e) { 34 selectedOffset = -1; 35 OffsetDialog.this.setVisible(false); 36 } 37 }); 34 cancelButton.addActionListener(this); 38 35 buttonPanel.add(cancelButton); // todo: proper button 39 36 setContentPane(buttonPanel); … … 43 40 44 41 public ImageryOffsetBase showDialog() { 45 selectedOffset = -1;42 selectedOffset = null; 46 43 prepareDialog(); 47 44 setVisible(true); 48 return selectedOffset < 0 ? null : offsets.get(selectedOffset); 45 return selectedOffset; 46 } 47 48 public void actionPerformed( ActionEvent e ) { 49 if( e.getSource() instanceof OffsetDialogButton ) { 50 selectedOffset = ((OffsetDialogButton)e.getSource()).getOffset(); 51 } else 52 selectedOffset = null; 53 setVisible(false); 49 54 } 50 55 }
Note:
See TracChangeset
for help on using the changeset viewer.