Changeset 11308 in josm


Ignore:
Timestamp:
2016-11-25T21:07:05+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #14031 - change focus with TAB in "add imagery" dialogs

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddImageryPanel.java

    r10611 r11308  
    2626public abstract class AddImageryPanel extends JPanel {
    2727
    28     protected final JosmTextArea rawUrl = new JosmTextArea(3, 40);
     28    protected final JosmTextArea rawUrl = new JosmTextArea(3, 40).transferFocusOnTab();
    2929    protected final JosmTextField name = new JosmTextField();
    3030
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddTMSLayerPanel.java

    r11289 r11308  
    2323
    2424    private final JosmTextField tmsZoom = new JosmTextField();
    25     private final JosmTextArea tmsUrl = new JosmTextArea(3, 40);
     25    private final JosmTextArea tmsUrl = new JosmTextArea(3, 40).transferFocusOnTab();
    2626    private final transient KeyAdapter keyAdapter = new KeyAdapter() {
    2727        @Override
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java

    r11289 r11308  
    3838    private final JComboBox<String> formats = new JComboBox<>();
    3939    private final JLabel wmsInstruction;
    40     private final JosmTextArea wmsUrl = new JosmTextArea(3, 40);
     40    private final JosmTextArea wmsUrl = new JosmTextArea(3, 40).transferFocusOnTab();
    4141    private final JButton showBounds = new JButton(tr("Show bounds"));
    4242
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmTextArea.java

    r10694 r11308  
    22package org.openstreetmap.josm.gui.widgets;
    33
     4import java.awt.KeyboardFocusManager;
    45import java.awt.event.FocusEvent;
    56import java.awt.event.FocusListener;
     
    9091    }
    9192
     93    /**
     94     * Restore default behaviour of focus transfer with TAB, overriden by {@link JTextArea}.
     95     * @return {@code this}
     96     * @since 11308
     97     */
     98    public JosmTextArea transferFocusOnTab() {
     99        // http://stackoverflow.com/a/525867/2257172
     100        setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
     101        setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
     102        return this;
     103    }
     104
    92105    @Override
    93106    public void focusGained(FocusEvent e) {
Note: See TracChangeset for help on using the changeset viewer.