- Timestamp:
- 2019-09-01T20:19:49+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/util
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/util/StayOpenCheckBoxMenuItem.java
r15288 r15330 14 14 public class StayOpenCheckBoxMenuItem extends JCheckBoxMenuItem { 15 15 16 private static volatile MenuElement[] path;16 private static volatile MenuElement[] path; 17 17 18 {19 getModel().addChangeListener(e -> {20 if (getModel().isArmed() && isShowing()) {21 path = MenuSelectionManager.defaultManager().getSelectedPath();22 }23 });24 }18 { 19 getModel().addChangeListener(e -> { 20 if (getModel().isArmed() && isShowing()) { 21 path = MenuSelectionManager.defaultManager().getSelectedPath(); 22 } 23 }); 24 } 25 25 26 /**27 * Constructs a new {@code StayOpenCheckBoxMenuItem} whose properties are taken from the Action supplied.28 * @param a action29 */30 public StayOpenCheckBoxMenuItem(Action a) {31 super(a);32 }26 /** 27 * Constructs a new initially unselected {@code StayOpenCheckBoxMenuItem} with no set text or icon. 28 * @see JCheckBoxMenuItem#JCheckBoxMenuItem() 29 */ 30 public StayOpenCheckBoxMenuItem() { 31 super(); 32 } 33 33 34 /** 35 * Overridden to reopen the menu. 36 * 37 * @param pressTime the time to "hold down" the button, in milliseconds 38 */ 39 @Override 40 public void doClick(int pressTime) { 41 super.doClick(pressTime); 42 MenuSelectionManager.defaultManager().setSelectedPath(path); 43 } 34 /** 35 * Constructs a new {@code StayOpenCheckBoxMenuItem} whose properties are taken from the Action supplied. 36 * @param a action 37 * @see JCheckBoxMenuItem#JCheckBoxMenuItem(Action) 38 */ 39 public StayOpenCheckBoxMenuItem(Action a) { 40 super(a); 41 } 42 43 /** 44 * Overridden to reopen the menu. 45 * 46 * @param pressTime the time to "hold down" the button, in milliseconds 47 */ 48 @Override 49 public void doClick(int pressTime) { 50 super.doClick(pressTime); 51 MenuSelectionManager.defaultManager().setSelectedPath(path); 52 } 44 53 }
Note:
See TracChangeset
for help on using the changeset viewer.