Ignore:
Timestamp:
2021-04-13T18:05:39+02:00 (5 years ago)
Author:
simon04
Message:

fix #19645 - Add a search icon to search boxes of lists (icon by Klumbumbus, PD and CC0 licensed)

Location:
trunk/src/org/openstreetmap/josm/gui/preferences
Files:
5 edited

Legend:

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

    r17713 r17768  
    2727import javax.swing.JButton;
    2828import javax.swing.JFileChooser;
    29 import javax.swing.JLabel;
    3029import javax.swing.JMenu;
    3130import javax.swing.JOptionPane;
     
    5453import org.openstreetmap.josm.gui.util.GuiHelper;
    5554import org.openstreetmap.josm.gui.widgets.AbstractFileChooser;
     55import org.openstreetmap.josm.gui.widgets.FilterField;
    5656import org.openstreetmap.josm.gui.widgets.JosmTextField;
    5757import org.openstreetmap.josm.spi.preferences.Config;
     
    168168        final JPanel txtFilterPanel = new JPanel(new GridBagLayout());
    169169        p.add(txtFilterPanel, GBC.eol().fill(GBC.HORIZONTAL));
    170         txtFilter = new JosmTextField();
    171         JLabel lbFilter = new JLabel(tr("Search:"));
    172         lbFilter.setLabelFor(txtFilter);
    173         txtFilterPanel.add(lbFilter, GBC.std().insets(0, 0, 5, 0));
    174         txtFilterPanel.add(txtFilter, GBC.eol().fill(GBC.HORIZONTAL));
     170        txtFilter = new FilterField();
     171        txtFilterPanel.add(txtFilter, GBC.eol().insets(0, 0, 0, 5).fill(GBC.HORIZONTAL));
    175172        txtFilter.getDocument().addDocumentListener(DocumentAdapter.create(ignore -> applyFilter()));
    176173        readPreferences(Preferences.main());
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java

    r17648 r17768  
    373373        JPanel panel = new JPanel(new GridBagLayout());
    374374        panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    375         panel.add(colorFilter, GBC.eol().fill(HORIZONTAL));
     375        panel.add(colorFilter, GBC.eol().insets(0, 0, 0, 5).fill(HORIZONTAL));
    376376        JScrollPane scrollpane = new JScrollPane(colors);
    377377        scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java

    r17332 r17768  
    99import java.awt.BorderLayout;
    1010import java.awt.Component;
    11 import java.awt.GridBagConstraints;
    1211import java.awt.GridBagLayout;
    1312import java.awt.GridLayout;
    14 import java.awt.Insets;
    1513import java.awt.event.ActionEvent;
    1614import java.awt.event.ComponentAdapter;
     
    2826
    2927import javax.swing.AbstractAction;
    30 import javax.swing.BorderFactory;
    3128import javax.swing.ButtonGroup;
    3229import javax.swing.DefaultListModel;
     
    167164    private JPanel buildSearchFieldPanel() {
    168165        JPanel pnl = new JPanel(new GridBagLayout());
    169         pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    170         GridBagConstraints gc = new GridBagConstraints();
    171 
    172         gc.anchor = GridBagConstraints.NORTHWEST;
    173         gc.fill = HORIZONTAL;
    174         gc.weightx = 0.0;
    175         gc.insets = new Insets(0, 0, 0, 3);
    176166        pnl.add(GBC.glue(0, 0));
    177167
    178         gc.weightx = 1.0;
    179168        ButtonGroup bg = new ButtonGroup();
    180169        JPanel radios = new JPanel();
    181         addRadioButton(bg, radios, new JRadioButton(trc("plugins", "All"), true), gc, PluginInstallation.ALL);
    182         addRadioButton(bg, radios, new JRadioButton(trc("plugins", "Installed")), gc, PluginInstallation.INSTALLED);
    183         addRadioButton(bg, radios, new JRadioButton(trc("plugins", "Available")), gc, PluginInstallation.AVAILABLE);
    184         pnl.add(radios, gc);
    185 
    186         gc.gridx = 0;
    187         gc.weightx = 0.0;
    188         pnl.add(new JLabel(tr("Search:")), gc);
    189 
    190         gc.gridx = 1;
    191         gc.weightx = 1.0;
     170        addRadioButton(bg, radios, new JRadioButton(trc("plugins", "All"), true), PluginInstallation.ALL);
     171        addRadioButton(bg, radios, new JRadioButton(trc("plugins", "Installed")), PluginInstallation.INSTALLED);
     172        addRadioButton(bg, radios, new JRadioButton(trc("plugins", "Available")), PluginInstallation.AVAILABLE);
     173        pnl.add(radios, GBC.eol().fill(HORIZONTAL));
     174
    192175        pnl.add(new FilterField().filter(expr -> {
    193176            model.filterDisplayedPlugins(expr);
    194177            pnlPluginPreferences.refreshView();
    195         }), gc);
     178        }), GBC.eol().insets(0, 0, 0, 5).fill(HORIZONTAL));
    196179        return pnl;
    197180    }
    198181
    199     private void addRadioButton(ButtonGroup bg, JPanel pnl, JRadioButton rb, GridBagConstraints gc, PluginInstallation value) {
     182    private void addRadioButton(ButtonGroup bg, JPanel pnl, JRadioButton rb, PluginInstallation value) {
    200183        bg.add(rb);
    201         pnl.add(rb, gc);
     184        pnl.add(rb, GBC.std());
    202185        rb.addActionListener(e -> {
    203186            model.filterDisplayedPlugins(value);
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeSelectionPanel.java

    r16960 r17768  
    2323import org.openstreetmap.josm.gui.preferences.projection.CodeProjectionChoice.CodeComparator;
    2424import org.openstreetmap.josm.gui.util.TableHelper;
     25import org.openstreetmap.josm.gui.widgets.FilterField;
    2526import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2627import org.openstreetmap.josm.tools.GBC;
     
    3233public class CodeSelectionPanel extends JPanel implements ListSelectionListener, DocumentListener {
    3334
    34     private final JosmTextField filter = new JosmTextField(30);
     35    private final JosmTextField filter = new FilterField();
    3536    private final ProjectionCodeModel model = new ProjectionCodeModel();
    3637    private JTable table;
     
    104105
    105106        this.setLayout(new GridBagLayout());
    106         this.add(filter, GBC.eol().weight(1.0, 0.0));
     107        this.add(filter, GBC.eol().fill(GBC.HORIZONTAL).weight(1.0, 0.0));
    107108        this.add(scroll, GBC.eol().fill(GBC.HORIZONTAL));
    108109    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java

    r17733 r17768  
    88import java.awt.Component;
    99import java.awt.Dimension;
    10 import java.awt.GridBagConstraints;
    1110import java.awt.GridBagLayout;
    1211import java.awt.GridLayout;
    13 import java.awt.Insets;
    1412import java.awt.Toolkit;
    1513import java.awt.event.KeyEvent;
     
    2119
    2220import javax.swing.AbstractAction;
    23 import javax.swing.BorderFactory;
    2421import javax.swing.BoxLayout;
    2522import javax.swing.DefaultComboBoxModel;
     
    4441import org.openstreetmap.josm.gui.widgets.FilterField;
    4542import org.openstreetmap.josm.gui.widgets.JosmComboBox;
     43import org.openstreetmap.josm.tools.GBC;
    4644import org.openstreetmap.josm.tools.KeyboardUtils;
    4745import org.openstreetmap.josm.tools.Logging;
     
    251249        // copied from PluginPreference
    252250        JPanel pnl = new JPanel(new GridBagLayout());
    253         pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    254         GridBagConstraints gc = new GridBagConstraints();
    255 
    256         gc.anchor = GridBagConstraints.NORTHWEST;
    257         gc.fill = GridBagConstraints.HORIZONTAL;
    258         gc.weightx = 0.0;
    259         gc.insets = new Insets(0, 0, 0, 5);
    260         pnl.add(new JLabel(tr("Search:")), gc);
    261 
    262         gc.gridx = 1;
    263         gc.weightx = 1.0;
    264         pnl.add(filterField, gc);
    265         pnl.setMaximumSize(new Dimension(300, 10));
     251        pnl.add(filterField, GBC.eol().insets(0, 0, 0, 5).fill(GBC.HORIZONTAL));
     252        pnl.setMaximumSize(new Dimension(Integer.MAX_VALUE, 10));
    266253        return pnl;
    267254    }
Note: See TracChangeset for help on using the changeset viewer.