Changeset 31340 in osm
- Timestamp:
- 2015-07-05T14:24:34+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java
r31328 r31340 4 4 5 5 import java.awt.FlowLayout; 6 import java.awt.event.ActionEvent; 6 7 8 import javax.swing.AbstractAction; 9 import javax.swing.JButton; 7 10 import javax.swing.JCheckBox; 11 import javax.swing.JDialog; 12 import javax.swing.JOptionPane; 8 13 import javax.swing.JPanel; 9 14 … … 51 56 panel.add(format24); 52 57 panel.add(moveTo); 58 JButton oauth = new JButton(new OAuthAction()); 59 oauth.setText("Login"); 60 panel.add(oauth); 53 61 gui.getDisplayPreference().addSubTab(this, "Mapillary", panel); 54 62 } … … 73 81 } 74 82 83 public class OAuthAction extends AbstractAction { 84 85 @Override 86 public void actionPerformed(ActionEvent arg0) { 87 JButton login = new JButton(); 88 JButton cancel = new JButton(); 89 JOptionPane pane = new JOptionPane(new MapillaryOAuthUI(), 90 JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, 91 null, new JButton[] { login, cancel }); 92 login.setAction(new LoginAction(pane)); 93 cancel.setAction(new CancelAction(pane)); 94 JDialog dlg = pane.createDialog(Main.parent, tr("Login")); 95 dlg.setVisible(true); 96 dlg.dispose(); 97 } 98 } 99 100 private class LoginAction extends AbstractAction { 101 private JOptionPane pane; 102 103 public LoginAction(JOptionPane pane) { 104 putValue(NAME, tr("Login")); 105 this.pane = pane; 106 } 107 108 @Override 109 public void actionPerformed(ActionEvent e) { 110 pane.setValue(JOptionPane.OK_OPTION); 111 } 112 } 113 114 private class CancelAction extends AbstractAction { 115 private JOptionPane pane; 116 117 public CancelAction(JOptionPane pane) { 118 putValue(NAME, tr("Cancel")); 119 this.pane = pane; 120 } 121 122 @Override 123 public void actionPerformed(ActionEvent e) { 124 pane.setValue(JOptionPane.CANCEL_OPTION); 125 } 126 } 75 127 }
Note:
See TracChangeset
for help on using the changeset viewer.