Changeset 17146 in josm


Ignore:
Timestamp:
2020-10-10T19:05:40+02:00 (2 weeks ago)
Author:
simon04
Message:

see #19902 - Advanced preferences: use FlowLayout for buttons, add tooltip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

    r17036 r17146  
    77import java.awt.Dimension;
    88import java.awt.GridBagLayout;
     9import java.awt.GridLayout;
    910import java.awt.event.ActionEvent;
    1011import java.awt.event.ActionListener;
     
    2425
    2526import javax.swing.AbstractAction;
    26 import javax.swing.Box;
    2727import javax.swing.JButton;
    2828import javax.swing.JFileChooser;
     
    202202        scroll.setPreferredSize(new Dimension(400, 200));
    203203
     204        JPanel buttonPanel = new JPanel(new GridLayout(1, 6));
    204205        JButton add = new JButton(tr("Add"), ImageProvider.get("dialogs/add", ImageProvider.ImageSizes.SMALLICON));
    205         p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
    206         p.add(add, GBC.std().insets(0, 5, 0, 0));
     206        buttonPanel.add(add);
     207        add.setToolTipText(add.getText());
    207208        add.addActionListener(e -> {
    208209            PrefEntry pe = table.addPreference(gui);
     
    215216
    216217        JButton edit = new JButton(tr("Edit"), ImageProvider.get("dialogs/edit", ImageProvider.ImageSizes.SMALLICON));
    217         p.add(edit, GBC.std().insets(5, 5, 5, 0));
     218        buttonPanel.add(edit);
     219        edit.setToolTipText(edit.getText());
    218220        edit.addActionListener(e -> {
    219221            if (table.editPreference(gui))
     
    223225
    224226        JButton reset = new JButton(tr("Reset"), ImageProvider.get("undo", ImageProvider.ImageSizes.SMALLICON));
    225         p.add(reset, GBC.std().insets(0, 5, 0, 0));
     227        buttonPanel.add(reset);
     228        reset.setToolTipText(reset.getText());
    226229        reset.addActionListener(e -> table.resetPreferences(gui));
    227230        table.getSelectionModel().addListSelectionListener(event -> reset.setEnabled(table.getSelectedRowCount() > 0));
    228231
    229232        JButton read = new JButton(tr("Read from file"), ImageProvider.get("open", ImageProvider.ImageSizes.SMALLICON));
    230         p.add(read, GBC.std().insets(5, 5, 0, 0));
     233        buttonPanel.add(read);
     234        read.setToolTipText(read.getText());
    231235        read.addActionListener(e -> readPreferencesFromXML());
    232236
    233237        JButton export = new JButton(tr("Export selected items"), ImageProvider.get("save", ImageProvider.ImageSizes.SMALLICON));
    234         p.add(export, GBC.std().insets(5, 5, 0, 0));
     238        buttonPanel.add(export);
     239        export.setToolTipText(export.getText());
    235240        export.addActionListener(e -> exportSelectedToXML());
    236241
    237242        final JButton more = new JButton(tr("More..."));
    238         p.add(more, GBC.std().insets(5, 5, 0, 0));
     243        buttonPanel.add(more);
     244        more.setToolTipText(more.getText());
    239245        more.addActionListener(new ActionListener() {
    240246            private final JPopupMenu menu = buildPopupMenu();
     
    246252            }
    247253        });
     254        p.add(buttonPanel, GBC.eol());
    248255    }
    249256
Note: See TracChangeset for help on using the changeset viewer.