Changeset 12396 in josm for trunk


Ignore:
Timestamp:
2017-06-11T15:43:41+02:00 (7 years ago)
Author:
michael2402
Message:

LayerVisibilityAction: Align the texts more nicely.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityAction.java

    r12395 r12396  
    2121import javax.swing.AbstractAction;
    2222import javax.swing.BorderFactory;
     23import javax.swing.Icon;
    2324import javax.swing.ImageIcon;
    2425import javax.swing.JCheckBox;
     
    2930import javax.swing.JPopupMenu;
    3031import javax.swing.JSlider;
     32import javax.swing.UIManager;
    3133import javax.swing.border.Border;
    3234
     
    9597
    9698    private void addContentEntry(LayerVisibilityMenuEntry slider) {
    97         content.add(slider.getPanel(), GBC.eop());
     99        content.add(slider.getPanel(), GBC.eop().fill(GBC.HORIZONTAL));
    98100        sliders.add(slider);
    99101    }
     
    181183        VisibilityCheckbox() {
    182184            super(tr("Show layer"));
     185
     186            // Align all texts
     187            Icon icon = UIManager.getIcon("CheckBox.icon");
     188            int iconWidth = icon == null ? 20 : icon.getIconWidth();
     189            setBorder(BorderFactory.createEmptyBorder(0, Math.max(24 + 5 - iconWidth, 0), 0, 0));
    183190            addChangeListener(e -> setVisibleFlag(isSelected()));
    184191        }
     
    223230
    224231            add(new JLabel(getIcon()), GBC.std().span(1, 2).insets(0, 0, 5, 0));
    225             add(new JLabel(getLabel()), GBC.eol());
     232            add(new JLabel(getLabel()), GBC.eol().insets(5, 0, 5, 0));
    226233            add(slider, GBC.eol());
    227234            addMouseWheelListener(this::mouseWheelMoved);
     
    539546        public ColorSelector() {
    540547            super(new GridBagLayout());
     548            add(new JLabel(tr("Color")), GBC.eol().insets(24 + 10, 0, 0, 0));
    541549            for (Color color : COLORS) {
    542550                addPanelForColor(color);
Note: See TracChangeset for help on using the changeset viewer.