Changeset 15288 in josm


Ignore:
Timestamp:
2019-08-07T02:39:36+02:00 (2 weeks ago)
Author:
Don-vip
Message:

see #10435 - keep the style settings menu open after one has been selected, like for mappaint menu

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/BooleanStyleSettingGui.java

    r12831 r15288  
    44import java.awt.event.ActionEvent;
    55import java.util.Arrays;
     6import java.util.Objects;
    67
    78import javax.swing.AbstractAction;
     
    1112
    1213import org.openstreetmap.josm.gui.MainApplication;
     14import org.openstreetmap.josm.gui.mappaint.StyleSetting.BooleanStyleSetting;
    1315import org.openstreetmap.josm.gui.mappaint.loader.MapPaintStyleLoader;
     16import org.openstreetmap.josm.gui.util.StayOpenCheckBoxMenuItemUI;
    1417
    1518/**
    16  * GUI elements for a {@link StyleSetting.BooleanStyleSetting} class.
     19 * GUI elements for a {@link BooleanStyleSetting} class.
    1720 * @since 12831
    1821 */
     
    2124    final StyleSetting.BooleanStyleSetting setting;
    2225
    23     public BooleanStyleSettingGui(StyleSetting.BooleanStyleSetting setting) {
    24         this.setting = setting;
     26    /**
     27     * Constructs a new {@code BooleanStyleSettingGui}.
     28     * @param setting boolean style setting
     29     */
     30    public BooleanStyleSettingGui(BooleanStyleSetting setting) {
     31        this.setting = Objects.requireNonNull(setting);
    2532    }
    2633
     
    3744        item.setAction(a);
    3845        item.setSelected((boolean) setting.getValue());
     46        item.setUI(new StayOpenCheckBoxMenuItemUI());
    3947        menu.add(item);
    4048    }
  • trunk/src/org/openstreetmap/josm/gui/util/StayOpenCheckBoxMenuItem.java

    r14302 r15288  
    1010 * An extension of JCheckBoxMenuItem that doesn't close the menu when selected.
    1111 *
    12  * @author Darryl https://tips4java.wordpress.com/2010/09/12/keeping-menus-open/
     12 * @author Darryl Burke https://tips4java.wordpress.com/2010/09/12/keeping-menus-open/
    1313 */
    1414public class StayOpenCheckBoxMenuItem extends JCheckBoxMenuItem {
Note: See TracChangeset for help on using the changeset viewer.