Ticket #4429: josmtextfield_02.patch

File josmtextfield_02.patch, 113.7 KB (added by noon, 6 years ago)

Patch for context menu, version 2

  • src/org/openstreetmap/josm/gui/preferences/map/BackupPreference.java

     
    1414import javax.swing.JPanel;
    1515import javax.swing.JScrollPane;
    1616import javax.swing.JSeparator;
    17 import javax.swing.JTextField;
    1817
    1918import org.openstreetmap.josm.data.AutosaveTask;
    2019import org.openstreetmap.josm.data.preferences.BooleanProperty;
     
    2524import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    2625import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel;
    2726import org.openstreetmap.josm.tools.GBC;
     27import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2828
    2929public class BackupPreference implements SubPreferenceSetting {
    3030
     
    3737    private static final BooleanProperty PROP_KEEP_BACKUP = new BooleanProperty("save.keepbackup", false);
    3838    private JCheckBox keepBackup;
    3939    private JCheckBox autosave;
    40     private final JTextField autosaveInterval = new JTextField(8);
    41     private final JTextField backupPerLayer = new JTextField(8);
     40    private final JosmTextField autosaveInterval = new JosmTextField(8);
     41    private final JosmTextField backupPerLayer = new JosmTextField(8);
    4242
    4343    @Override
    4444    public void addGui(PreferenceTabbedPane gui) {
  • src/org/openstreetmap/josm/gui/preferences/PluginPreference.java

     
    2929import javax.swing.JPanel;
    3030import javax.swing.JScrollPane;
    3131import javax.swing.JTabbedPane;
    32 import javax.swing.JTextField;
    3332import javax.swing.SwingUtilities;
    3433import javax.swing.UIManager;
    3534import javax.swing.event.DocumentEvent;
     
    5251import org.openstreetmap.josm.plugins.ReadRemotePluginInformationTask;
    5352import org.openstreetmap.josm.tools.GBC;
    5453import org.openstreetmap.josm.tools.ImageProvider;
     54import org.openstreetmap.josm.gui.widgets.JosmTextField;
    5555
    5656public class PluginPreference extends DefaultTabPreferenceSetting {
    5757    public static class Factory implements PreferenceSettingFactory {
     
    9797        return sb.toString();
    9898    }
    9999
    100     private JTextField tfFilter;
     100    private JosmTextField tfFilter;
    101101    private PluginListPanel pnlPluginPreferences;
    102102    private PluginPreferencesModel model;
    103103    private JScrollPane spPluginPreferences;
     
    122122
    123123        gc.gridx = 1;
    124124        gc.weightx = 1.0;
    125         pnl.add(tfFilter = new JTextField(), gc);
     125        pnl.add(tfFilter = new JosmTextField(), gc);
    126126        tfFilter.setToolTipText(tr("Enter a search expression"));
    127127        SelectAllOnFocusGainedDecorator.decorate(tfFilter);
    128128        tfFilter.getDocument().addDocumentListener(new SearchFieldAdapter());
  • src/org/openstreetmap/josm/gui/preferences/AudioPreference.java

     
    99import javax.swing.JCheckBox;
    1010import javax.swing.JLabel;
    1111import javax.swing.JPanel;
    12 import javax.swing.JTextField;
    1312
    1413import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.tools.GBC;
     15import org.openstreetmap.josm.gui.widgets.JosmTextField;
    1616
    1717/*
    1818 * marker.audiosampleminsecs
     
    4949    private JCheckBox audioMarkersFromWavTimestamps = new JCheckBox(tr("Modified times (time stamps) of audio files."));
    5050    private JCheckBox audioMarkersFromStart = new JCheckBox(tr("Start of track (will always do this if no other markers available)."));
    5151
    52     private JTextField audioLeadIn = new JTextField(8);
    53     private JTextField audioForwardBackAmount = new JTextField(8);
    54     private JTextField audioFastForwardMultiplier = new JTextField(8);
    55     private JTextField audioCalibration = new JTextField(8);
     52    private JosmTextField audioLeadIn = new JosmTextField(8);
     53    private JosmTextField audioForwardBackAmount = new JosmTextField(8);
     54    private JosmTextField audioFastForwardMultiplier = new JosmTextField(8);
     55    private JosmTextField audioCalibration = new JosmTextField(8);
    5656
    5757    public void addGui(PreferenceTabbedPane gui) {
    5858        JPanel audio = new JPanel(new GridBagLayout());
  • src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

     
    5858import javax.swing.JScrollPane;
    5959import javax.swing.JSeparator;
    6060import javax.swing.JTable;
    61 import javax.swing.JTextField;
    6261import javax.swing.JToolBar;
    6362import javax.swing.KeyStroke;
    6463import javax.swing.ListCellRenderer;
     
    9190import org.openstreetmap.josm.tools.LanguageInfo;
    9291import org.openstreetmap.josm.tools.Utils;
    9392import org.xml.sax.SAXException;
     93import org.openstreetmap.josm.gui.widgets.JosmTextField;
    9494
    9595public abstract class SourceEditor extends JPanel {
    9696
     
    679679
    680680    protected class EditSourceEntryDialog extends ExtendedDialog {
    681681
    682         private JTextField tfTitle;
    683         private JTextField tfURL;
     682        private JosmTextField tfTitle;
     683        private JosmTextField tfURL;
    684684        private JCheckBox cbActive;
    685685
    686686        public EditSourceEntryDialog(Component parent, String title, SourceEntry e) {
     
    690690
    691691            JPanel p = new JPanel(new GridBagLayout());
    692692
    693             tfTitle = new JTextField(60);
     693            tfTitle = new JosmTextField(60);
    694694            p.add(new JLabel(tr("Name (optional):")), GBC.std().insets(15, 0, 5, 5));
    695695            p.add(tfTitle, GBC.eol().insets(0, 0, 5, 5));
    696696
    697             tfURL = new JTextField(60);
     697            tfURL = new JosmTextField(60);
    698698            p.add(new JLabel(tr("URL / File:")), GBC.std().insets(15, 0, 5, 0));
    699699            p.add(tfURL, GBC.std().insets(0, 0, 5, 5));
    700700            JButton fileChooser = new JButton(new LaunchFileChooserAction());
     
    13171317    }
    13181318
    13191319    class FileOrUrlCellEditor extends JPanel implements TableCellEditor {
    1320         private JTextField tfFileName;
     1320        private JosmTextField tfFileName;
    13211321        private CopyOnWriteArrayList<CellEditorListener> listeners;
    13221322        private String value;
    13231323        private boolean isFile;
     
    13331333            gc.fill = GridBagConstraints.BOTH;
    13341334            gc.weightx = 1.0;
    13351335            gc.weighty = 1.0;
    1336             add(tfFileName = new JTextField(), gc);
     1336            add(tfFileName = new JosmTextField(), gc);
    13371337
    13381338            gc.gridx = 1;
    13391339            gc.gridy = 0;
  • src/org/openstreetmap/josm/gui/preferences/imagery/AddTMSLayerPanel.java

     
    1010
    1111import javax.swing.JLabel;
    1212import javax.swing.JTextArea;
    13 import javax.swing.JTextField;
    1413import javax.swing.text.View;
    1514
    1615import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1716import org.openstreetmap.josm.tools.GBC;
    1817import org.openstreetmap.josm.tools.Utils;
     18import org.openstreetmap.josm.gui.widgets.JosmTextField;
    1919
    2020public class AddTMSLayerPanel extends AddImageryPanel {
    2121
    22     private final JTextField tmsZoom = new JTextField();
     22    private final JosmTextField tmsZoom = new JosmTextField();
    2323    private final JTextArea tmsUrl = new JTextArea(3, 40);
    2424    private final KeyAdapter keyAdapter = new KeyAdapter() {
    2525        @Override
  • src/org/openstreetmap/josm/gui/preferences/imagery/TMSSettingsPanel.java

     
    99import javax.swing.JLabel;
    1010import javax.swing.JPanel;
    1111import javax.swing.JSpinner;
    12 import javax.swing.JTextField;
    1312import javax.swing.SpinnerNumberModel;
    1413
    1514import org.openstreetmap.josm.gui.layer.TMSLayer;
    1615import org.openstreetmap.josm.tools.GBC;
     16import org.openstreetmap.josm.gui.widgets.JosmTextField;
    1717
    1818/**
    1919 * {@code JPanel} giving access to TMS settings.
     
    2727    private final JSpinner minZoomLvl;
    2828    private final JSpinner maxZoomLvl;
    2929    private final JCheckBox addToSlippyMapChosser = new JCheckBox();
    30     private final JTextField tilecacheDir = new JTextField();
     30    private final JosmTextField tilecacheDir = new JosmTextField();
    3131
    3232    /**
    3333     * Constructs a new {@code TMSSettingsPanel}.
  • src/org/openstreetmap/josm/gui/preferences/imagery/AddImageryPanel.java

     
    99import javax.swing.AbstractButton;
    1010import javax.swing.JPanel;
    1111import javax.swing.JTextArea;
    12 import javax.swing.JTextField;
    1312import javax.swing.event.ChangeEvent;
    1413import javax.swing.event.ChangeListener;
    1514import javax.swing.event.DocumentEvent;
     
    1716import javax.swing.text.JTextComponent;
    1817
    1918import org.openstreetmap.josm.data.imagery.ImageryInfo;
     19import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2020
    2121/**
    2222 * An abstract imagery panel used to add WMS/TMS imagery sources. See implementations.
     
    2727public abstract class AddImageryPanel extends JPanel {
    2828
    2929    protected final JTextArea rawUrl = new JTextArea(3, 40);
    30     protected final JTextField name = new JTextField();
     30    protected final JosmTextField name = new JosmTextField();
    3131   
    3232    protected final Collection<ContentValidationListener> listeners = new ArrayList<ContentValidationListener>();
    3333   
  • src/org/openstreetmap/josm/gui/preferences/plugin/PluginUpdatePolicyPanel.java

     
    1414import javax.swing.JLabel;
    1515import javax.swing.JPanel;
    1616import javax.swing.JRadioButton;
    17 import javax.swing.JTextField;
    1817import javax.swing.event.ChangeEvent;
    1918import javax.swing.event.ChangeListener;
    2019
     
    2221import org.openstreetmap.josm.gui.JMultilineLabel;
    2322import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
    2423import org.openstreetmap.josm.plugins.PluginHandler;
     24import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2525
    2626/**
    2727 * A panel for configuring whether JOSM shall update plugins at startup.
     
    5858    private ButtonGroup bgTimeBasedUpdatePolicy;
    5959    private Map<Policy, JRadioButton> rbVersionBasedUpatePolicy;
    6060    private Map<Policy, JRadioButton> rbTimeBasedUpatePolicy;
    61     private JTextField tfUpdateInterval;
     61    private JosmTextField tfUpdateInterval;
    6262    private JLabel lblUpdateInterval;
    6363
    6464    protected JPanel buildVersionBasedUpdatePolicyPanel() {
     
    9595    protected JPanel buildUpdateIntervalPanel() {
    9696        JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
    9797        pnl.add(lblUpdateInterval = new JLabel(tr("Update interval (in days):")));
    98         pnl.add(tfUpdateInterval = new JTextField(5));
     98        pnl.add(tfUpdateInterval = new JosmTextField(5));
    9999        SelectAllOnFocusGainedDecorator.decorate(tfUpdateInterval);
    100100        return pnl;
    101101    }
  • src/org/openstreetmap/josm/gui/preferences/advanced/StringEditor.java

     
    77
    88import javax.swing.JLabel;
    99import javax.swing.JPanel;
    10 import javax.swing.JTextField;
    1110
    1211import org.openstreetmap.josm.data.Preferences.StringSetting;
    1312import org.openstreetmap.josm.gui.ExtendedDialog;
    1413import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
    1514import org.openstreetmap.josm.gui.preferences.advanced.AdvancedPreference.PrefEntry;
    1615import org.openstreetmap.josm.tools.GBC;
     16import org.openstreetmap.josm.gui.widgets.JosmTextField;
    1717
    1818public class StringEditor extends ExtendedDialog {
    1919
    2020    PrefEntry entry;
    21     JTextField tvalue;
     21    JosmTextField tvalue;
    2222
    2323    public StringEditor(final PreferenceTabbedPane gui, PrefEntry entry, StringSetting setting) {
    2424        super(gui, tr("Change string setting"), new String[] {tr("OK"), tr("Cancel")});
     
    3636        p.add(new JLabel(tr("Key: {0}", entry.getKey())), GBC.eol().insets(0,0,5,0));
    3737
    3838        p.add(new JLabel(tr("Value: ")), GBC.std());
    39         tvalue = new JTextField(orig, 50);
     39        tvalue = new JosmTextField(orig, 50);
    4040        p.add(tvalue, GBC.eop().insets(5,0,0,0).fill(GBC.HORIZONTAL));
    4141
    4242        return p;
  • src/org/openstreetmap/josm/gui/preferences/advanced/ListListEditor.java

     
    1818import javax.swing.JPanel;
    1919import javax.swing.JScrollPane;
    2020import javax.swing.JTable;
    21 import javax.swing.JTextField;
    2221import javax.swing.JToolBar;
    2322import javax.swing.event.ListSelectionEvent;
    2423import javax.swing.event.ListSelectionListener;
     
    3231import org.openstreetmap.josm.tools.GBC;
    3332import org.openstreetmap.josm.tools.ImageProvider;
    3433import org.openstreetmap.josm.tools.WindowGeometry;
     34import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3535
    3636public class ListListEditor extends ExtendedDialog {
    3737
     
    9494        table.putClientProperty("terminateEditOnFocusLost", true);
    9595        table.setTableHeader(null);
    9696
    97         DefaultCellEditor editor = new DefaultCellEditor(new JTextField());
     97        DefaultCellEditor editor = new DefaultCellEditor(new JosmTextField());
    9898        editor.setClickCountToStart(1);
    9999        table.setDefaultEditor(table.getColumnClass(0), editor);
    100100
  • src/org/openstreetmap/josm/gui/preferences/advanced/MapListEditor.java

     
    2222import javax.swing.JPanel;
    2323import javax.swing.JScrollPane;
    2424import javax.swing.JTable;
    25 import javax.swing.JTextField;
    2625import javax.swing.JToolBar;
    2726import javax.swing.event.ListSelectionEvent;
    2827import javax.swing.event.ListSelectionListener;
     
    3635import org.openstreetmap.josm.tools.GBC;
    3736import org.openstreetmap.josm.tools.ImageProvider;
    3837import org.openstreetmap.josm.tools.WindowGeometry;
     38import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3939
    4040public class MapListEditor extends ExtendedDialog {
    4141
     
    116116        table.putClientProperty("terminateEditOnFocusLost", true);
    117117        table.getTableHeader().getColumnModel().getColumn(0).setHeaderValue(tr("Key"));
    118118        table.getTableHeader().getColumnModel().getColumn(1).setHeaderValue(tr("Value"));
    119         DefaultCellEditor editor = new DefaultCellEditor(new JTextField());
     119        DefaultCellEditor editor = new DefaultCellEditor(new JosmTextField());
    120120        editor.setClickCountToStart(1);
    121121        table.setDefaultEditor(table.getColumnClass(0), editor);
    122122
  • src/org/openstreetmap/josm/gui/preferences/advanced/ListEditor.java

     
    1313import javax.swing.JPanel;
    1414import javax.swing.JScrollPane;
    1515import javax.swing.JTable;
    16 import javax.swing.JTextField;
    1716import javax.swing.table.AbstractTableModel;
    1817
    1918import org.openstreetmap.josm.data.Preferences.ListSetting;
     
    2221import org.openstreetmap.josm.gui.preferences.advanced.AdvancedPreference.PrefEntry;
    2322import org.openstreetmap.josm.tools.GBC;
    2423import org.openstreetmap.josm.tools.WindowGeometry;
     24import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2525
    2626public class ListEditor extends ExtendedDialog {
    2727
     
    5454        table.putClientProperty("terminateEditOnFocusLost", true);
    5555        table.setTableHeader(null);
    5656
    57         DefaultCellEditor editor = new DefaultCellEditor(new JTextField());
     57        DefaultCellEditor editor = new DefaultCellEditor(new JosmTextField());
    5858        editor.setClickCountToStart(1);
    5959        table.setDefaultEditor(table.getColumnClass(0), editor);
    6060
  • src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

     
    3333import javax.swing.JRadioButton;
    3434import javax.swing.JScrollPane;
    3535import javax.swing.JTable;
    36 import javax.swing.JTextField;
    3736import javax.swing.event.DocumentEvent;
    3837import javax.swing.event.DocumentListener;
    3938import javax.swing.filechooser.FileFilter;
     
    5857import org.openstreetmap.josm.tools.CheckParameterUtil;
    5958import org.openstreetmap.josm.tools.GBC;
    6059import org.openstreetmap.josm.tools.Utils;
     60import org.openstreetmap.josm.gui.widgets.JosmTextField;
    6161
    6262public class AdvancedPreference extends DefaultTabPreferenceSetting {
    6363
     
    143143    private AllSettingsTableModel model;
    144144    protected List<PrefEntry> data;
    145145    protected List<PrefEntry> displayData;
    146     protected JTextField txtFilter;
     146    protected JosmTextField txtFilter;
    147147
    148148    public void addGui(final PreferenceTabbedPane gui) {
    149149        JPanel p = gui.createPreferenceTab(this);
    150150
    151         txtFilter = new JTextField();
     151        txtFilter = new JosmTextField();
    152152        JLabel lbFilter = new JLabel(tr("Search: "));
    153153        lbFilter.setLabelFor(txtFilter);
    154154        p.add(lbFilter);
     
    452452
    453453    private static class SettingCellEditor extends DefaultCellEditor {
    454454        public SettingCellEditor() {
    455             super(new JTextField());
     455            super(new JosmTextField());
    456456        }
    457457
    458458        @Override
     
    522522    private void addPreference(final PreferenceTabbedPane gui) {
    523523        JPanel p = new JPanel(new GridBagLayout());
    524524        p.add(new JLabel(tr("Key")), GBC.std().insets(0,0,5,0));
    525         JTextField tkey = new JTextField("", 50);
     525        JosmTextField tkey = new JosmTextField("", 50);
    526526        p.add(tkey, GBC.eop().insets(5,0,0,0).fill(GBC.HORIZONTAL));
    527527
    528528        p.add(new JLabel(tr("Select Setting Type:")), GBC.eol().insets(5,15,5,0));
  • src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java

     
    1616import javax.swing.JOptionPane;
    1717import javax.swing.JPanel;
    1818import javax.swing.JRadioButton;
    19 import javax.swing.JTextField;
    2019import javax.swing.event.ChangeEvent;
    2120import javax.swing.event.ChangeListener;
    2221
     
    2928import org.openstreetmap.josm.tools.GBC;
    3029import org.openstreetmap.josm.tools.template_engine.ParseError;
    3130import org.openstreetmap.josm.tools.template_engine.TemplateParser;
     31import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3232
    3333public class GPXSettingsPanel extends JPanel implements ValidationListener {
    3434
     
    4444    private JRadioButton drawRawGpsLinesLocal = new JRadioButton(tr("Local files"));
    4545    private JRadioButton drawRawGpsLinesNone = new JRadioButton(tr("None"));
    4646    private ActionListener drawRawGpsLinesActionListener;
    47     private JTextField drawRawGpsMaxLineLength = new JTextField(8);
    48     private JTextField drawRawGpsMaxLineLengthLocal = new JTextField(8);
    49     private JTextField drawLineWidth = new JTextField(2);
     47    private JosmTextField drawRawGpsMaxLineLength = new JosmTextField(8);
     48    private JosmTextField drawRawGpsMaxLineLengthLocal = new JosmTextField(8);
     49    private JosmTextField drawLineWidth = new JosmTextField(2);
    5050    private JCheckBox forceRawGpsLines = new JCheckBox(tr("Force lines if no segments imported"));
    5151    private JCheckBox largeGpsPoints = new JCheckBox(tr("Draw large GPS points"));
    5252    private JCheckBox hdopCircleGpsPoints = new JCheckBox(tr("Draw a circle from HDOP value"));
     
    6161    private JCheckBox makeAutoMarkers = new JCheckBox(tr("Create markers when reading GPX"));
    6262    private JCheckBox drawGpsArrows = new JCheckBox(tr("Draw Direction Arrows"));
    6363    private JCheckBox drawGpsArrowsFast = new JCheckBox(tr("Fast drawing (looks uglier)"));
    64     private JTextField drawGpsArrowsMinDist = new JTextField(8);
     64    private JosmTextField drawGpsArrowsMinDist = new JosmTextField(8);
    6565    private JCheckBox colorDynamic = new JCheckBox(tr("Dynamic color range based on data limits"));
    6666    private JosmComboBox waypointLabel = new JosmComboBox(LABEL_PATTERN_DESC);
    67     private JTextField waypointLabelPattern = new JTextField();
     67    private JosmTextField waypointLabelPattern = new JosmTextField();
    6868    private JosmComboBox audioWaypointLabel = new JosmComboBox(LABEL_PATTERN_DESC);
    69     private JTextField audioWaypointLabelPattern = new JTextField();
     69    private JosmTextField audioWaypointLabelPattern = new JosmTextField();
    7070    private JCheckBox useGpsAntialiasing = new JCheckBox(tr("Smooth GPX graphics (antialiasing)"));
    7171
    7272    private String layerName;
     
    421421        savePreferences(null, false);
    422422    }
    423423
    424     private void updateWaypointLabelCombobox(JosmComboBox cb, JTextField tf, TemplateEntryProperty property) {
     424    private void updateWaypointLabelCombobox(JosmComboBox cb, JosmTextField tf, TemplateEntryProperty property) {
    425425        String labelPattern = property.getAsString();
    426426        boolean found = false;
    427427        for (int i=0; i<LABEL_PATTERN_TEMPLATE.length; i++) {
     
    438438        }
    439439    }
    440440
    441     private void updateWaypointPattern(JosmComboBox cb, JTextField tf) {
     441    private void updateWaypointPattern(JosmComboBox cb, JosmTextField tf) {
    442442        if (cb.getSelectedIndex() == WAYPOINT_LABEL_CUSTOM) {
    443443            tf.setEnabled(true);
    444444        } else {
  • src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java

     
    2020import javax.swing.JCheckBox;
    2121import javax.swing.JLabel;
    2222import javax.swing.JPanel;
    23 import javax.swing.JTextField;
    2423import javax.swing.SwingUtilities;
    2524import javax.swing.event.DocumentEvent;
    2625import javax.swing.event.DocumentListener;
     
    3332import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
    3433import org.openstreetmap.josm.io.OsmApi;
    3534import org.openstreetmap.josm.tools.ImageProvider;
     35import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3636
    3737public class OsmApiUrlInputPanel extends JPanel {
    3838    static public final String API_URL_PROP = OsmApiUrlInputPanel.class.getName() + ".apiUrl";
    3939
    4040    private JLabel lblValid;
    4141    private JLabel lblApiUrl;
    42     private JTextField tfOsmServerUrl;
     42    private JosmTextField tfOsmServerUrl;
    4343    private ApiUrlValidator valOsmServerUrl;
    4444    private SideButton btnTest;
    4545    /** indicates whether to use the default OSM URL or not */
     
    8989
    9090        gc.gridx = 1;
    9191        gc.weightx = 1.0;
    92         add(tfOsmServerUrl = new JTextField(), gc);
     92        add(tfOsmServerUrl = new JosmTextField(), gc);
    9393        SelectAllOnFocusGainedDecorator.decorate(tfOsmServerUrl);
    9494        valOsmServerUrl = new ApiUrlValidator(tfOsmServerUrl);
    9595        valOsmServerUrl.validate();
  • src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java

     
    2121import javax.swing.JCheckBox;
    2222import javax.swing.JLabel;
    2323import javax.swing.JPanel;
    24 import javax.swing.JTextField;
    2524
    2625import org.openstreetmap.josm.Main;
    2726import org.openstreetmap.josm.data.oauth.OAuthParameters;
     
    3332import org.openstreetmap.josm.gui.oauth.TestAccessTokenTask;
    3433import org.openstreetmap.josm.io.auth.CredentialsManager;
    3534import org.openstreetmap.josm.tools.ImageProvider;
     35import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3636
    3737/**
    3838 * The preferences panel for the OAuth preferences. This just a summary panel
     
    213213     *
    214214     */
    215215    private class AlreadyAuthorisedPanel extends JPanel {
    216         private JTextField tfAccessTokenKey;
    217         private JTextField tfAccessTokenSecret;
     216        private JosmTextField tfAccessTokenKey;
     217        private JosmTextField tfAccessTokenSecret;
    218218
    219219        protected void build() {
    220220            setLayout(new GridBagLayout());
     
    237237
    238238            gc.gridx = 1;
    239239            gc.weightx = 1.0;
    240             add(tfAccessTokenKey = new JTextField(), gc);
     240            add(tfAccessTokenKey = new JosmTextField(), gc);
    241241            tfAccessTokenKey.setEditable(false);
    242242
    243243            // -- access token secret
     
    249249
    250250            gc.gridx = 1;
    251251            gc.weightx = 1.0;
    252             add(tfAccessTokenSecret = new JTextField(), gc);
     252            add(tfAccessTokenSecret = new JosmTextField(), gc);
    253253            tfAccessTokenSecret.setEditable(false);
    254254
    255255            // -- access token secret
  • src/org/openstreetmap/josm/gui/preferences/server/BasicAuthenticationPreferencesPanel.java

     
    1414import javax.swing.JLabel;
    1515import javax.swing.JPanel;
    1616import javax.swing.JPasswordField;
    17 import javax.swing.JTextField;
    1817
    1918import org.openstreetmap.josm.gui.widgets.JosmPasswordField;
    2019import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
     
    2221import org.openstreetmap.josm.io.auth.CredentialsAgentException;
    2322import org.openstreetmap.josm.io.auth.CredentialsManager;
    2423import org.openstreetmap.josm.io.OsmApi;
     24import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2525
    2626/**
    2727 * The preferences panel for parameters necessary for the Basic Authentication
     
    3131public class BasicAuthenticationPreferencesPanel extends JPanel {
    3232
    3333    /** the OSM user name */
    34     private JTextField tfOsmUserName;
     34    private JosmTextField tfOsmUserName;
    3535    private UserNameValidator valUserName;
    3636    /** the OSM password */
    3737    private JPasswordField tfOsmPassword;
     
    5555
    5656        gc.gridx = 1;
    5757        gc.weightx = 1.0;
    58         add(tfOsmUserName = new JTextField(), gc);
     58        add(tfOsmUserName = new JosmTextField(), gc);
    5959        SelectAllOnFocusGainedDecorator.decorate(tfOsmUserName);
    6060        valUserName = new UserNameValidator(tfOsmUserName);
    6161        valUserName.validate();
  • src/org/openstreetmap/josm/gui/preferences/server/ProxyPreferencesPanel.java

     
    2323import javax.swing.JPanel;
    2424import javax.swing.JPasswordField;
    2525import javax.swing.JRadioButton;
    26 import javax.swing.JTextField;
    2726
     27import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2828import org.openstreetmap.josm.Main;
    2929import org.openstreetmap.josm.gui.JMultilineLabel;
    3030import org.openstreetmap.josm.gui.help.HelpUtil;
     
    7474
    7575    private ButtonGroup bgProxyPolicy;
    7676    private Map<ProxyPolicy, JRadioButton> rbProxyPolicy;
    77     private JTextField tfProxyHttpHost;
    78     private JTextField tfProxyHttpPort;
    79     private JTextField tfProxySocksHost;
    80     private JTextField tfProxySocksPort;
    81     private JTextField tfProxyHttpUser;
     77    private JosmTextField tfProxyHttpHost;
     78    private JosmTextField tfProxyHttpPort;
     79    private JosmTextField tfProxySocksHost;
     80    private JosmTextField tfProxySocksPort;
     81    private JosmTextField tfProxyHttpUser;
    8282    private JPasswordField tfProxyHttpPassword;
    8383
    8484    private JPanel pnlHttpProxyConfigurationPanel;
     
    106106
    107107        gc.gridx = 1;
    108108        gc.weightx = 1.0;
    109         pnl.add(tfProxyHttpHost = new JTextField(),gc);
     109        pnl.add(tfProxyHttpHost = new JosmTextField(),gc);
    110110
    111111        gc.gridy = 1;
    112112        gc.gridx = 0;
     
    116116
    117117        gc.gridx = 1;
    118118        gc.weightx = 1.0;
    119         pnl.add(tfProxyHttpPort = new JTextField(5),gc);
     119        pnl.add(tfProxyHttpPort = new JosmTextField(5),gc);
    120120        tfProxyHttpPort.setMinimumSize(tfProxyHttpPort.getPreferredSize());
    121121
    122122        gc.gridy = 2;
     
    136136        gc.gridy = 3;
    137137        gc.gridx = 1;
    138138        gc.weightx = 1.0;
    139         pnl.add(tfProxyHttpUser = new JTextField(20),gc);
     139        pnl.add(tfProxyHttpUser = new JosmTextField(20),gc);
    140140        tfProxyHttpUser.setMinimumSize(tfProxyHttpUser.getPreferredSize());
    141141
    142142        gc.gridy = 4;
     
    181181
    182182        gc.gridx = 1;
    183183        gc.weightx = 1.0;
    184         pnl.add(tfProxySocksHost = new JTextField(20),gc);
     184        pnl.add(tfProxySocksHost = new JosmTextField(20),gc);
    185185
    186186        gc.gridy = 1;
    187187        gc.gridx = 0;
     
    191191
    192192        gc.gridx = 1;
    193193        gc.weightx = 1.0;
    194         pnl.add(tfProxySocksPort = new JTextField(5), gc);
     194        pnl.add(tfProxySocksPort = new JosmTextField(5), gc);
    195195        tfProxySocksPort.setMinimumSize(tfProxySocksPort.getPreferredSize());
    196196
    197197        // add an extra spacer, otherwise the layout is broken
  • src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java

     
    2828import javax.swing.JPanel;
    2929import javax.swing.JScrollPane;
    3030import javax.swing.JTable;
    31 import javax.swing.JTextField;
    3231import javax.swing.KeyStroke;
    3332import javax.swing.ListSelectionModel;
    3433import javax.swing.RowFilter;
     
    4746import org.openstreetmap.josm.gui.widgets.JosmComboBox;
    4847import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
    4948import org.openstreetmap.josm.tools.Shortcut;
     49import org.openstreetmap.josm.gui.widgets.JosmTextField;
    5050
    5151/**
    5252 * This is the keyboard preferences content.
     
    137137
    138138    JTable shortcutTable = new JTable();
    139139
    140     private JTextField filterField = new JTextField();
     140    private JosmTextField filterField = new JosmTextField();
    141141
    142142    /** Creates new form prefJPanel */
    143143    // Ain't those auto-generated comments helpful or what? <g>
  • src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java

     
    1818import javax.swing.JList;
    1919import javax.swing.JPanel;
    2020import javax.swing.JScrollPane;
    21 import javax.swing.JTextField;
    2221import javax.swing.event.DocumentEvent;
    2322import javax.swing.event.DocumentListener;
    2423import javax.swing.event.ListSelectionEvent;
     
    2726import org.openstreetmap.josm.data.projection.Projection;
    2827import org.openstreetmap.josm.data.projection.Projections;
    2928import org.openstreetmap.josm.tools.GBC;
     29import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3030
    3131/**
    3232 * Projection choice that lists all known projects by code.
     
    4141
    4242    private class CodeSelectionPanel extends JPanel implements ListSelectionListener, DocumentListener {
    4343
    44         public JTextField filter;
     44        public JosmTextField filter;
    4545        private ProjectionCodeListModel model;
    4646        public JList selectionList;
    4747        List<String> data;
     
    107107        }
    108108
    109109        private void build() {
    110             filter = new JTextField(30);
     110            filter = new JosmTextField(30);
    111111            filter.setColumns(10);
    112112            filter.getDocument().addDocumentListener(this);
    113113
  • src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java

     
    2020import javax.swing.JComponent;
    2121import javax.swing.JLabel;
    2222import javax.swing.JPanel;
    23 import javax.swing.JTextField;
    2423import javax.swing.plaf.basic.BasicComboBoxEditor;
    2524
    2625import org.openstreetmap.josm.Main;
     
    3635import org.openstreetmap.josm.tools.GBC;
    3736import org.openstreetmap.josm.tools.ImageProvider;
    3837import org.openstreetmap.josm.tools.Utils;
     38import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3939
    4040public class CustomProjectionChoice extends AbstractProjectionChoice implements SubPrefsOptions {
    4141
     
    4747
    4848    private static class PreferencePanel extends JPanel {
    4949
    50         public JTextField input;
     50        public JosmTextField input;
    5151        private HistoryComboBox cbInput;
    5252
    5353        public PreferencePanel(String initialText, ActionListener listener) {
     
    5555        }
    5656
    5757        private void build(String initialText, final ActionListener listener) {
    58             input = new JTextField(30);
     58            input = new JosmTextField(30);
    5959            cbInput = new HistoryComboBox();
    6060            cbInput.setPrototypeDisplayValue(new AutoCompletionListItem("xxxx"));
    6161            cbInput.setEditor(new BasicComboBoxEditor() {
    6262                @Override
    63                 protected JTextField createEditorComponent() {
     63                protected JosmTextField createEditorComponent() {
    6464                    return input;
    6565                }
    6666            });
  • src/org/openstreetmap/josm/gui/MapStatus.java

     
    3333import javax.swing.JPanel;
    3434import javax.swing.JProgressBar;
    3535import javax.swing.JScrollPane;
    36 import javax.swing.JTextField;
    3736import javax.swing.Popup;
    3837import javax.swing.PopupFactory;
    3938import javax.swing.UIManager;
     
    4948import org.openstreetmap.josm.gui.util.GuiHelper;
    5049import org.openstreetmap.josm.tools.GBC;
    5150import org.openstreetmap.josm.tools.ImageProvider;
     51import org.openstreetmap.josm.gui.widgets.JosmTextField;
    5252
    5353/**
    5454 * A component that manages some status information display about the map.
     
    150150
    151151    final ImageLabel lonText = new ImageLabel("lon", tr("The geographic longitude at the mouse pointer."), 11);
    152152    final ImageLabel nameText = new ImageLabel("name", tr("The name of the object at the mouse pointer."), 20);
    153     final JTextField helpText = new JTextField();
     153    final JosmTextField helpText = new JosmTextField();
    154154    final ImageLabel latText = new ImageLabel("lat", tr("The geographic latitude at the mouse pointer."), 11);
    155155    final ImageLabel angleText = new ImageLabel("angle", tr("The angle between the previous and the current way segment."), 6);
    156156    final ImageLabel headingText = new ImageLabel("heading", tr("The (compass) heading of the line segment being drawn."), 6);
  • src/org/openstreetmap/josm/gui/widgets/AbstractIdTextField.java

     
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.widgets;
    33
    4 import javax.swing.JTextField;
    54import javax.swing.text.JTextComponent;
    65
     6import org.openstreetmap.josm.gui.widgets.JosmTextField;
    77import org.openstreetmap.josm.tools.Utils;
    88
    99/**
     
    1212 * @param <T> The ID validator class
    1313 * @since 5765
    1414 */
    15 public abstract class AbstractIdTextField<T extends AbstractTextComponentValidator> extends JTextField {
     15public abstract class AbstractIdTextField<T extends AbstractTextComponentValidator> extends JosmTextField {
    1616
    1717    protected final T validator;
    1818
  • src/org/openstreetmap/josm/gui/widgets/HistoryComboBox.java

     
    88import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox;
    99import org.openstreetmap.josm.Main;
    1010
     11import java.awt.*;
     12import java.awt.event.*;
     13
     14import javax.swing.*;
     15import javax.swing.event.*;
     16import javax.swing.text.*;
     17import javax.swing.undo.*;
     18import static org.openstreetmap.josm.tools.I18n.tr;
     19
    1120public class HistoryComboBox extends AutoCompletingComboBox {
    1221    private ComboBoxHistory model;
     22    private JPopupMenu contextMenu;
     23    private UndoManager undoManager;
    1324
     25
    1426    public static final int DEFAULT_SEARCH_HISTORY_SIZE = 15;
    1527
    1628    public HistoryComboBox() {
    1729        int maxsize = Main.pref.getInteger("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE);
    1830        setModel(model = new ComboBoxHistory(maxsize));
    1931        setEditable(true);
     32        initContext();
    2033    }
    2134
     35    private void initContext(){
     36        undoManager = new UndoManager();
     37        contextMenu = new JPopupMenu();
     38        UndoAction undoAction = new UndoAction();
     39        addToContextMenu(tr("Paste"),      DefaultEditorKit.pasteAction);
     40        contextMenu.addSeparator();
     41        addToContextMenu(tr("Cut"),        DefaultEditorKit.cutAction);
     42        addToContextMenu(tr("Copy"),       DefaultEditorKit.copyAction);
     43        addToContextMenu(tr("Delete"),     DefaultEditorKit.deleteNextCharAction);
     44        contextMenu.addSeparator();
     45        addToContextMenu(tr("Select All"), DefaultEditorKit.selectAllAction);
     46        contextMenu.addSeparator();
     47        contextMenu.add(new JMenuItem(undoAction));
     48        ((JTextComponent)getEditor().getEditorComponent()).getDocument().addUndoableEditListener(undoAction);
     49
     50        addMouseListener(new MouseAdapter() {
     51            public void mousePressed(MouseEvent e) {
     52                if (e.getButton() == MouseEvent.BUTTON3) {
     53                    contextMenu.show(HistoryComboBox.this, e.getX(), e.getY());
     54                }
     55            }
     56        });
     57    }
     58
     59    private void addToContextMenu(String label, String actionName) {
     60        Action action = getActionMap().get(actionName);
     61        if (action != null) {
     62            JMenuItem mi = new JMenuItem(action);
     63            mi.setText(label);
     64            contextMenu.add(mi);
     65        }
     66    }
     67
     68
     69    class UndoAction extends AbstractAction implements UndoableEditListener {
     70        public UndoAction() {
     71            super(tr("Undo"));
     72            setEnabled(false);
     73        }
     74         
     75        public void undoableEditHappened(UndoableEditEvent e) {
     76            undoManager.addEdit(e.getEdit());
     77            setEnabled(undoManager.canUndo());
     78        }
     79
     80        public void actionPerformed(ActionEvent e) {
     81            try {
     82                undoManager.undo();
     83            } catch (CannotUndoException ex) {
     84            }
     85            setEnabled(undoManager.canUndo());
     86        }
     87    }   
     88   
    2289    public String getText() {
    2390        return ((JTextComponent)getEditor().getEditorComponent()).getText();
    2491    }
  • src/org/openstreetmap/josm/gui/widgets/DisableShortcutsOnFocusGainedTextField.java

     
    1111import javax.swing.Action;
    1212import javax.swing.JMenu;
    1313import javax.swing.JMenuItem;
    14 import javax.swing.JTextField;
    1514import javax.swing.KeyStroke;
    1615import javax.swing.text.Document;
    1716
     
    1918import org.openstreetmap.josm.actions.JosmAction;
    2019import org.openstreetmap.josm.tools.Pair;
    2120import org.openstreetmap.josm.tools.Shortcut;
     21import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2222
    2323/**
    2424 * A JTextField that disabled all JOSM shortcuts composed of a single key without modifier (except F1 to F12),
     
    2626 * This allows to include text fields in toggle dialogs (needed for relation filter).
    2727 * @since 5696
    2828 */
    29 public class DisableShortcutsOnFocusGainedTextField extends JTextField implements FocusListener {
     29public class DisableShortcutsOnFocusGainedTextField extends JosmTextField implements FocusListener {
    3030
    3131    /**
    3232     * Constructs a new <code>TextField</code>.  A default model is created,
  • src/org/openstreetmap/josm/gui/widgets/JosmComboBox.java

     
    1313import javax.swing.ComboBoxModel;
    1414import javax.swing.DefaultComboBoxModel;
    1515import javax.swing.JComboBox;
     16import javax.swing.JPopupMenu;
    1617import javax.swing.JList;
    1718import javax.swing.plaf.basic.ComboPopup;
    1819
     20
     21
    1922/**
    2023 * Class overriding each {@link JComboBox} in JOSM to control consistently the number of displayed items at once.<br/>
    2124 * This is needed because of the default Java behaviour that may display the top-down list off the screen (see #7917).
     
    2326 * @since 5429
    2427 */
    2528public class JosmComboBox extends JComboBox {
    26 
    2729    /**
    2830     * The default prototype value used to compute the maximum number of elements to be displayed at once before
    2931     * displaying a scroll bar
     
    105107    public JosmComboBox(Vector<?> items) {
    106108        super(items);
    107109        init(findPrototypeDisplayValue(items));
     110
    108111    }
    109112   
     113
     114   
     115   
    110116    /**
    111117     * Finds the prototype display value to use among the given possible candidates.
    112118     * @param possibleValues The possible candidates that will be iterated.
  • src/org/openstreetmap/josm/gui/widgets/AbstractTextComponentValidator.java

     
    1010import java.beans.PropertyChangeListener;
    1111
    1212import javax.swing.BorderFactory;
    13 import javax.swing.JTextField;
    1413import javax.swing.UIManager;
    1514import javax.swing.border.Border;
    1615import javax.swing.event.DocumentEvent;
     
    1918
    2019import org.openstreetmap.josm.tools.CheckParameterUtil;
    2120import org.openstreetmap.josm.tools.Utils;
     21import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2222
    2323/**
    2424 * This is an abstract class for a validator on a text component.
     
    109109            tc.getDocument().addDocumentListener(this);
    110110        }
    111111        if (addActionListener) {
    112             if (tc instanceof JTextField) {
    113                 JTextField tf = (JTextField)tc;
     112            if (tc instanceof JosmTextField) {
     113                JosmTextField tf = (JosmTextField)tc;
    114114                tf.addActionListener(this);
    115115            }
    116116        }
  • src/org/openstreetmap/josm/gui/widgets/BoundingBoxSelectionPanel.java

     
    1818import javax.swing.JLabel;
    1919import javax.swing.JPanel;
    2020import javax.swing.JPopupMenu;
    21 import javax.swing.JTextField;
    2221import javax.swing.event.DocumentEvent;
    2322import javax.swing.event.DocumentListener;
    2423import javax.swing.text.JTextComponent;
     
    3130import org.openstreetmap.josm.tools.ImageProvider;
    3231import org.openstreetmap.josm.tools.OsmUrlToBounds;
    3332import org.openstreetmap.josm.tools.Utils;
     33import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3434
    3535/**
    3636 *
     
    3838 */
    3939public class BoundingBoxSelectionPanel extends JPanel {
    4040
    41     private JTextField[] tfLatLon = null;
    42     private final JTextField tfOsmUrl = new JTextField();
     41    private JosmTextField[] tfLatLon = null;
     42    private final JosmTextField tfOsmUrl = new JosmTextField();
    4343
    4444    protected void buildInputFields() {
    45         tfLatLon = new JTextField[4];
     45        tfLatLon = new JosmTextField[4];
    4646        for(int i=0; i< 4; i++) {
    47             tfLatLon[i] = new JTextField(11);
    48             tfLatLon[i].setMinimumSize(new Dimension(100,new JTextField().getMinimumSize().height));
     47            tfLatLon[i] = new JosmTextField(11);
     48            tfLatLon[i].setMinimumSize(new Dimension(100,new JosmTextField().getMinimumSize().height));
    4949            SelectAllOnFocusGainedDecorator.decorate(tfLatLon[i]);
    5050        }
    5151        LatitudeValidator.decorate(tfLatLon[0]);
  • src/org/openstreetmap/josm/gui/widgets/JosmTextField.java

     
     1package org.openstreetmap.josm.gui.widgets;
     2
     3import java.awt.*;
     4import java.awt.event.*;
     5
     6import javax.swing.*;
     7import javax.swing.event.*;
     8import javax.swing.text.*;
     9import javax.swing.undo.*;
     10
     11import static org.openstreetmap.josm.tools.I18n.tr;
     12
     13public class JosmTextField extends JTextField {
     14    private JPopupMenu contextMenu;
     15    private UndoManager undoManager;
     16
     17    public JosmTextField(Document doc, String text, int columns){
     18        super(doc, text, columns);
     19        init();
     20    }
     21
     22    public JosmTextField(String text, int columns){
     23        super(text, columns);
     24        init();
     25    }
     26
     27    public JosmTextField(String text){
     28        super(text);
     29        init();
     30    }
     31
     32    public JosmTextField(int columns){
     33        super(columns);
     34        init();
     35    }
     36   
     37    public JosmTextField() {
     38        super();
     39        init();
     40    }
     41
     42    private void init(){
     43        undoManager = new UndoManager();
     44        contextMenu = new JPopupMenu();
     45        UndoAction undoAction = new UndoAction();
     46        addToContextMenu(tr("Paste"),      DefaultEditorKit.pasteAction);
     47        contextMenu.addSeparator();
     48        addToContextMenu(tr("Cut"),        DefaultEditorKit.cutAction);
     49        addToContextMenu(tr("Copy"),       DefaultEditorKit.copyAction);
     50        addToContextMenu(tr("Delete"),     DefaultEditorKit.deleteNextCharAction);
     51        contextMenu.addSeparator();
     52        addToContextMenu(tr("Select All"), DefaultEditorKit.selectAllAction);
     53        contextMenu.addSeparator();
     54        contextMenu.add(new JMenuItem(undoAction));
     55        getDocument().addUndoableEditListener(undoAction);
     56
     57        addMouseListener(new MouseAdapter() {
     58            public void mousePressed(MouseEvent e) {
     59                if (e.getButton() == MouseEvent.BUTTON3) {
     60                    contextMenu.show(JosmTextField.this, e.getX(), e.getY());
     61                }
     62            }
     63        });
     64    }
     65
     66    private void addToContextMenu(String label, String actionName) {
     67        Action action = getActionMap().get(actionName);
     68        if (action != null) {
     69            JMenuItem mi = new JMenuItem(action);
     70            mi.setText(label);
     71            contextMenu.add(mi);
     72        }
     73    }
     74
     75
     76    class UndoAction extends AbstractAction implements UndoableEditListener {
     77        public UndoAction() {
     78            super(tr("Undo"));
     79            setEnabled(false);
     80        }
     81         
     82        public void undoableEditHappened(UndoableEditEvent e) {
     83            undoManager.addEdit(e.getEdit());
     84            setEnabled(undoManager.canUndo());
     85        }
     86
     87        public void actionPerformed(ActionEvent e) {
     88            try {
     89                undoManager.undo();
     90            } catch (CannotUndoException ex) {
     91            }
     92            setEnabled(undoManager.canUndo());
     93        }
     94    }   
     95
     96}
  • src/org/openstreetmap/josm/gui/io/FilenameCellEditor.java

     
    1717import javax.swing.JButton;
    1818import javax.swing.JPanel;
    1919import javax.swing.JTable;
    20 import javax.swing.JTextField;
    2120import javax.swing.event.CellEditorListener;
    2221import javax.swing.event.ChangeEvent;
    2322import javax.swing.table.TableCellEditor;
    2423
    2524import org.openstreetmap.josm.actions.SaveActionBase;
     25import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2626
    2727/**
    2828 * This is a {@link TableCellEditor} for filenames. It provides a text input field and
     
    3131 *
    3232 */
    3333class FilenameCellEditor extends JPanel implements TableCellEditor {
    34     private JTextField tfFileName;
     34    private JosmTextField tfFileName;
    3535    private CopyOnWriteArrayList<CellEditorListener> listeners;
    3636    private File value;
    3737
     
    4646        gc.fill = GridBagConstraints.BOTH;
    4747        gc.weightx = 1.0;
    4848        gc.weighty = 1.0;
    49         add(tfFileName = new JTextField(), gc);
     49        add(tfFileName = new JosmTextField(), gc);
    5050
    5151        gc.gridx = 1;
    5252        gc.gridy = 0;
  • src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java

     
    2424import javax.swing.JLabel;
    2525import javax.swing.JPanel;
    2626import javax.swing.JRadioButton;
    27 import javax.swing.JTextField;
    2827import javax.swing.UIManager;
    2928import javax.swing.event.DocumentEvent;
    3029import javax.swing.event.DocumentListener;
     
    3332import org.openstreetmap.josm.gui.JMultilineLabel;
    3433import org.openstreetmap.josm.io.OsmApi;
    3534import org.openstreetmap.josm.tools.ImageProvider;
     35import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3636
    3737/**
    3838 * UploadStrategySelectionPanel is a panel for selecting an upload strategy.
     
    5555    private Map<UploadStrategy, JRadioButton> rbStrategy;
    5656    private Map<UploadStrategy, JLabel> lblNumRequests;
    5757    private Map<UploadStrategy, JMultilineLabel> lblStrategies;
    58     private JTextField tfChunkSize;
     58    private JosmTextField tfChunkSize;
    5959    private JPanel pnlMultiChangesetPolicyPanel;
    6060    private JRadioButton rbFillOneChangeset;
    6161    private JRadioButton rbUseMultipleChangesets;
     
    135135        gc.weightx = 0.0;
    136136        gc.weighty = 0.0;
    137137        gc.gridwidth = 1;
    138         pnl.add(tfChunkSize = new JTextField(4), gc);
     138        pnl.add(tfChunkSize = new JosmTextField(4), gc);
    139139        gc.gridx = 3;
    140140        gc.gridy = 2;
    141141        gc.weightx = 1.0;
     
    382382    static class TextFieldFocusHandler implements FocusListener {
    383383        public void focusGained(FocusEvent e) {
    384384            Component c = e.getComponent();
    385             if (c instanceof JTextField) {
    386                 JTextField tf = (JTextField)c;
     385            if (c instanceof JosmTextField) {
     386                JosmTextField tf = (JosmTextField)c;
    387387                tf.selectAll();
    388388            }
    389389        }
     
    391391    }
    392392
    393393    class ChunkSizeInputVerifier implements DocumentListener, PropertyChangeListener {
    394         protected void setErrorFeedback(JTextField tf, String message) {
     394        protected void setErrorFeedback(JosmTextField tf, String message) {
    395395            tf.setBorder(BorderFactory.createLineBorder(Color.RED, 1));
    396396            tf.setToolTipText(message);
    397397            tf.setBackground(BG_COLOR_ERROR);
    398398        }
    399399
    400         protected void clearErrorFeedback(JTextField tf, String message) {
     400        protected void clearErrorFeedback(JosmTextField tf, String message) {
    401401            tf.setBorder(UIManager.getBorder("TextField.border"));
    402402            tf.setToolTipText(message);
    403403            tf.setBackground(UIManager.getColor("TextField.background"));
  • src/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java

     
    2121import javax.swing.JLabel;
    2222import javax.swing.JPanel;
    2323import javax.swing.JTable;
    24 import javax.swing.JTextField;
    2524import javax.swing.event.CellEditorListener;
    2625import javax.swing.event.ChangeEvent;
    2726import javax.swing.table.TableCellEditor;
     
    2928
    3029import org.openstreetmap.josm.actions.SaveActionBase;
    3130import org.openstreetmap.josm.tools.GBC;
     31import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3232
    33 
    3433class LayerNameAndFilePathTableCell extends JPanel implements TableCellRenderer, TableCellEditor {
    3534    private final static Color colorError = new Color(255,197,197);
    3635    private final static String separator = System.getProperty("file.separator");
     
    3837
    3938    private final JLabel lblLayerName = new JLabel();
    4039    private final JLabel lblFilename = new JLabel("");
    41     private final JTextField tfFilename = new JTextField();
     40    private final JosmTextField tfFilename = new JosmTextField();
    4241    private final JButton btnFileChooser = new JButton(new LaunchFileChooserAction());
    4342
    4443    private final static GBC defaultCellStyle = GBC.eol().fill(GBC.HORIZONTAL).insets(2, 0, 2, 0);
  • src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java

     
    1414import javax.swing.JCheckBox;
    1515import javax.swing.JLabel;
    1616import javax.swing.JOptionPane;
    17 import javax.swing.JTextField;
    1817
    1918import org.openstreetmap.josm.data.Preferences;
    2019import org.openstreetmap.josm.data.oauth.OAuthParameters;
     
    2524import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel;
    2625import org.openstreetmap.josm.tools.CheckParameterUtil;
    2726import org.openstreetmap.josm.tools.ImageProvider;
     27import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2828
    2929/**
    3030 * Panel allowing the user to setup advanced OAuth parameters:
     
    4040public class AdvancedOAuthPropertiesPanel extends VerticallyScrollablePanel {
    4141
    4242    private JCheckBox cbUseDefaults;
    43     private JTextField tfConsumerKey;
    44     private JTextField tfConsumerSecret;
    45     private JTextField tfRequestTokenURL;
    46     private JTextField tfAccessTokenURL;
    47     private JTextField tfAuthoriseURL;
     43    private JosmTextField tfConsumerKey;
     44    private JosmTextField tfConsumerSecret;
     45    private JosmTextField tfRequestTokenURL;
     46    private JosmTextField tfAccessTokenURL;
     47    private JosmTextField tfAuthoriseURL;
    4848    private UseDefaultItemListener ilUseDefault;
    4949    private String apiUrl;
    5050
     
    6969
    7070        gc.gridx = 1;
    7171        gc.weightx = 1.0;
    72         add(tfConsumerKey = new JTextField(), gc);
     72        add(tfConsumerKey = new JosmTextField(), gc);
    7373        SelectAllOnFocusGainedDecorator.decorate(tfConsumerKey);
    7474
    7575        // -- consumer secret
     
    8080
    8181        gc.gridx = 1;
    8282        gc.weightx = 1.0;
    83         add(tfConsumerSecret = new JTextField(), gc);
     83        add(tfConsumerSecret = new JosmTextField(), gc);
    8484        SelectAllOnFocusGainedDecorator.decorate(tfConsumerSecret);
    8585
    8686        // -- request token URL
     
    9191
    9292        gc.gridx = 1;
    9393        gc.weightx = 1.0;
    94         add(tfRequestTokenURL = new JTextField(), gc);
     94        add(tfRequestTokenURL = new JosmTextField(), gc);
    9595        SelectAllOnFocusGainedDecorator.decorate(tfRequestTokenURL);
    9696
    9797        // -- access token URL
     
    102102
    103103        gc.gridx = 1;
    104104        gc.weightx = 1.0;
    105         add(tfAccessTokenURL = new JTextField(), gc);
     105        add(tfAccessTokenURL = new JosmTextField(), gc);
    106106        SelectAllOnFocusGainedDecorator.decorate(tfAccessTokenURL);
    107107
    108108
     
    114114
    115115        gc.gridx = 1;
    116116        gc.weightx = 1.0;
    117         add(tfAuthoriseURL = new JTextField(), gc);
     117        add(tfAuthoriseURL = new JosmTextField(), gc);
    118118        SelectAllOnFocusGainedDecorator.decorate(tfAuthoriseURL);
    119119
    120120        cbUseDefaults.addItemListener(ilUseDefault = new UseDefaultItemListener());
     
    176176
    177177    protected void setChildComponentsEnabled(boolean enabled){
    178178        for (Component c: getComponents()) {
    179             if (c instanceof JTextField || c instanceof JLabel) {
     179            if (c instanceof JosmTextField || c instanceof JLabel) {
    180180                c.setEnabled(enabled);
    181181            }
    182182        }
  • src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java

     
    2222import javax.swing.JPanel;
    2323import javax.swing.JPasswordField;
    2424import javax.swing.JTabbedPane;
    25 import javax.swing.JTextField;
    2625import javax.swing.event.DocumentEvent;
    2726import javax.swing.event.DocumentListener;
    2827import javax.swing.text.JTextComponent;
     
    4241import org.openstreetmap.josm.gui.widgets.JosmPasswordField;
    4342import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
    4443import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel;
     44import org.openstreetmap.josm.gui.widgets.JosmTextField;
    4545import org.openstreetmap.josm.io.OsmApi;
    4646import org.openstreetmap.josm.io.OsmTransferException;
    4747import org.openstreetmap.josm.io.auth.CredentialsAgent;
     
    5858 */
    5959public class FullyAutomaticAuthorizationUI extends AbstractAuthorizationUI {
    6060
    61     private JTextField tfUserName;
     61    private JosmTextField tfUserName;
    6262    private JPasswordField tfPassword;
    6363    private UserNameValidator valUserName;
    6464    private PasswordValidator valPassword;
     
    115115
    116116        gc.gridx = 1;
    117117        gc.weightx = 1.0;
    118         pnl.add(tfUserName = new JTextField(), gc);
     118        pnl.add(tfUserName = new JosmTextField(), gc);
    119119        SelectAllOnFocusGainedDecorator.decorate(tfUserName);
    120120        valUserName = new UserNameValidator(tfUserName);
    121121        valUserName.validate();
  • src/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUI.java

     
    1919import javax.swing.JCheckBox;
    2020import javax.swing.JLabel;
    2121import javax.swing.JPanel;
    22 import javax.swing.JTextField;
    2322import javax.swing.SwingUtilities;
    2423
    2524import org.openstreetmap.josm.Main;
     
    3029import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    3130import org.openstreetmap.josm.tools.ImageProvider;
    3231import org.openstreetmap.josm.tools.OpenBrowser;
     32import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3333
    3434/**
    3535 * This is the UI for running a semic-automic authorisation procedure.
     
    206206     */
    207207    private class RetrieveAccessTokenPanel extends JPanel {
    208208
    209         private JTextField tfAuthoriseUrl;
     209        private JosmTextField tfAuthoriseUrl;
    210210
    211211        protected JPanel buildTitlePanel() {
    212212            JPanel pnl = new JPanel(new BorderLayout());
     
    245245
    246246            gc.gridx = 1;
    247247            gc.weightx = 1.0;
    248             pnl.add(tfAuthoriseUrl = new JTextField(), gc);
     248            pnl.add(tfAuthoriseUrl = new JosmTextField(), gc);
    249249            tfAuthoriseUrl.setEditable(false);
    250250
    251251            return pnl;
  • src/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java

     
    1818import javax.swing.JLabel;
    1919import javax.swing.JPanel;
    2020import javax.swing.JTabbedPane;
    21 import javax.swing.JTextField;
    2221import javax.swing.event.DocumentEvent;
    2322import javax.swing.event.DocumentListener;
    2423import javax.swing.text.JTextComponent;
     
    3130import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    3231import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
    3332import org.openstreetmap.josm.tools.ImageProvider;
     33import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3434
    3535/**
    3636 * This is an UI which supports a JOSM user to get an OAuth Access Token in a fully
     
    4040 */
    4141public class ManualAuthorizationUI extends AbstractAuthorizationUI{
    4242
    43     private JTextField tfAccessTokenKey;
     43    private JosmTextField tfAccessTokenKey;
    4444    private AccessTokenKeyValidator valAccessTokenKey;
    45     private JTextField tfAccessTokenSecret;
     45    private JosmTextField tfAccessTokenSecret;
    4646    private AccessTokenSecretValidator valAccessTokenSecret;
    4747    private JCheckBox cbSaveToPreferences;
    4848    private HtmlPanel pnlMessage;
     
    7575
    7676        gc.gridx = 1;
    7777        gc.weightx = 1.0;
    78         pnl.add(tfAccessTokenKey = new JTextField(), gc);
     78        pnl.add(tfAccessTokenKey = new JosmTextField(), gc);
    7979        SelectAllOnFocusGainedDecorator.decorate(tfAccessTokenKey);
    8080        valAccessTokenKey = new AccessTokenKeyValidator(tfAccessTokenKey);
    8181        valAccessTokenKey.validate();
     
    8989
    9090        gc.gridx = 1;
    9191        gc.weightx = 1.0;
    92         pnl.add(tfAccessTokenSecret = new JTextField(), gc);
     92        pnl.add(tfAccessTokenSecret = new JosmTextField(), gc);
    9393        SelectAllOnFocusGainedDecorator.decorate(tfAccessTokenSecret);
    9494        valAccessTokenSecret = new AccessTokenSecretValidator(tfAccessTokenSecret);
    9595        valAccessTokenSecret.validate();
  • src/org/openstreetmap/josm/gui/oauth/AccessTokenInfoPanel.java

     
    1010import javax.swing.JCheckBox;
    1111import javax.swing.JLabel;
    1212import javax.swing.JPanel;
    13 import javax.swing.JTextField;
    1413
    1514import org.openstreetmap.josm.data.oauth.OAuthToken;
    1615import org.openstreetmap.josm.gui.preferences.server.OAuthAccessTokenHolder;
     16import org.openstreetmap.josm.gui.widgets.JosmTextField;
    1717
    1818/**
    1919 * Displays the key and the secret of an OAuth Access Token.
     
    2121 */
    2222public class AccessTokenInfoPanel extends JPanel {
    2323
    24     private JTextField tfAccessTokenKey;
    25     private JTextField tfAccessTokenSecret;
     24    private JosmTextField tfAccessTokenKey;
     25    private JosmTextField tfAccessTokenSecret;
    2626    private JCheckBox cbSaveAccessTokenInPreferences;
    2727
    2828    protected void build() {
     
    3838
    3939        gc.gridx = 1;
    4040        gc.weightx = 1.0;
    41         add(tfAccessTokenKey = new JTextField(), gc);
     41        add(tfAccessTokenKey = new JosmTextField(), gc);
    4242        tfAccessTokenKey.setEditable(false);
    4343
    4444        // the access token secret
     
    5050
    5151        gc.gridx = 1;
    5252        gc.weightx = 1.0;
    53         add(tfAccessTokenSecret = new JTextField(), gc);
     53        add(tfAccessTokenSecret = new JosmTextField(), gc);
    5454        tfAccessTokenSecret.setEditable(false);
    5555
    5656        // the checkbox
  • src/org/openstreetmap/josm/gui/oauth/FullyAutomaticPropertiesPanel.java

     
    1212import javax.swing.JLabel;
    1313import javax.swing.JPanel;
    1414import javax.swing.JPasswordField;
    15 import javax.swing.JTextField;
    1615import javax.swing.text.JTextComponent;
    1716
    1817import org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator;
    1918import org.openstreetmap.josm.gui.widgets.JosmPasswordField;
    2019import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
     20import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2121
    2222public class FullyAutomaticPropertiesPanel extends JPanel {
    2323
    24     private JTextField tfUserName;
     24    private JosmTextField tfUserName;
    2525    private JPasswordField tfPassword;
    2626    private UserNameValidator valUserName;
    2727
     
    4242
    4343        gc.gridx = 1;
    4444        gc.weightx = 1.0;
    45         pnl.add(tfUserName = new JTextField(), gc);
     45        pnl.add(tfUserName = new JosmTextField(), gc);
    4646        SelectAllOnFocusGainedDecorator.decorate(tfUserName);
    4747        valUserName = new UserNameValidator(tfUserName);
    4848        valUserName.validate();
  • src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java

     
    3232import javax.swing.JLabel;
    3333import javax.swing.JPanel;
    3434import javax.swing.JSpinner;
    35 import javax.swing.JTextField;
    3635import javax.swing.KeyStroke;
    3736import javax.swing.SpinnerNumberModel;
    3837import javax.swing.event.ChangeEvent;
     
    4948import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    5049import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
    5150import org.openstreetmap.josm.tools.ImageProvider;
     51import org.openstreetmap.josm.gui.widgets.JosmTextField;
    5252
    5353/**
    5454 * TileSelectionBBoxChooser allows to select a bounding box (i.e. for downloading) based
     
    209209    static private class TileGridInputPanel extends JPanel implements PropertyChangeListener{
    210210        static public final String TILE_BOUNDS_PROP = TileGridInputPanel.class.getName() + ".tileBounds";
    211211
    212         private JTextField tfMaxY;
    213         private JTextField tfMinY;
    214         private JTextField tfMaxX;
    215         private JTextField tfMinX;
     212        private JosmTextField tfMaxY;
     213        private JosmTextField tfMinY;
     214        private JosmTextField tfMaxX;
     215        private JosmTextField tfMinX;
    216216        private TileCoordinateValidator valMaxY;
    217217        private TileCoordinateValidator valMinY;
    218218        private TileCoordinateValidator valMaxX;
     
    266266
    267267            gc.gridx = 1;
    268268            gc.weightx = 0.5;
    269             pnl.add(tfMinX = new JTextField(), gc);
     269            pnl.add(tfMinX = new JosmTextField(), gc);
    270270            valMinX = new TileCoordinateValidator(tfMinX);
    271271            SelectAllOnFocusGainedDecorator.decorate(tfMinX);
    272272            tfMinX.addActionListener(tileBoundsBuilder);
     
    274274
    275275            gc.gridx = 2;
    276276            gc.weightx = 0.5;
    277             pnl.add(tfMaxX = new JTextField(), gc);
     277            pnl.add(tfMaxX = new JosmTextField(), gc);
    278278            valMaxX = new TileCoordinateValidator(tfMaxX);
    279279            SelectAllOnFocusGainedDecorator.decorate(tfMaxX);
    280280            tfMaxX.addActionListener(tileBoundsBuilder);
     
    287287
    288288            gc.gridx = 1;
    289289            gc.weightx = 0.5;
    290             pnl.add(tfMinY = new JTextField(), gc);
     290            pnl.add(tfMinY = new JosmTextField(), gc);
    291291            valMinY = new TileCoordinateValidator(tfMinY);
    292292            SelectAllOnFocusGainedDecorator.decorate(tfMinY);
    293293            tfMinY.addActionListener(tileBoundsBuilder);
     
    295295
    296296            gc.gridx = 2;
    297297            gc.weightx = 0.5;
    298             pnl.add(tfMaxY = new JTextField(), gc);
     298            pnl.add(tfMaxY = new JosmTextField(), gc);
    299299            valMaxY = new TileCoordinateValidator(tfMaxY);
    300300            SelectAllOnFocusGainedDecorator.decorate(tfMaxY);
    301301            tfMaxY.addActionListener(tileBoundsBuilder);
     
    427427
    428428        static public final String TILE_BOUNDS_PROP = TileAddressInputPanel.class.getName() + ".tileBounds";
    429429
    430         private JTextField tfTileAddress;
     430        private JosmTextField tfTileAddress;
    431431        private TileAddressValidator valTileAddress;
    432432
    433433        protected JPanel buildTextPanel() {
     
    451451
    452452            gc.weightx = 1.0;
    453453            gc.gridx = 1;
    454             pnl.add(tfTileAddress = new JTextField(), gc);
     454            pnl.add(tfTileAddress = new JosmTextField(), gc);
    455455            valTileAddress = new TileAddressValidator(tfTileAddress);
    456456            SelectAllOnFocusGainedDecorator.decorate(tfTileAddress);
    457457
  • src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellEditor.java

     
    77
    88import javax.swing.AbstractCellEditor;
    99import javax.swing.JTable;
    10 import javax.swing.JTextField;
    1110import javax.swing.table.TableCellEditor;
    1211
    1312import org.openstreetmap.josm.data.osm.RelationMember;
     13import org.openstreetmap.josm.gui.widgets.JosmTextField;
    1414
     15
    1516/**
    1617 * {@link TableCellEditor} for the role column in a table for {@link RelationMember}s.
    1718 *
    1819 */
    1920public class RelationMemberTableCellEditor extends AbstractCellEditor implements TableCellEditor{
    2021
    21     private final JTextField editor;
     22    private final JosmTextField editor;
    2223
    2324    public RelationMemberTableCellEditor() {
    24         editor = new JTextField();
     25        editor = new JosmTextField();
    2526        editor.addFocusListener(
    2627                new FocusAdapter() {
    2728                    @Override
  • src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java

     
    2323import javax.swing.JPanel;
    2424import javax.swing.JPopupMenu;
    2525import javax.swing.JTextArea;
    26 import javax.swing.JTextField;
    2726import javax.swing.UIManager;
    2827import javax.swing.border.Border;
    2928import javax.swing.event.DocumentEvent;
     
    3736import org.openstreetmap.josm.tools.ImageProvider;
    3837import org.openstreetmap.josm.tools.OsmUrlToBounds;
    3938import org.openstreetmap.josm.tools.Utils;
     39import org.openstreetmap.josm.gui.widgets.JosmTextField;
    4040
    4141/**
    4242 * Bounding box selector.
     
    4848 */
    4949public class BoundingBoxSelection implements DownloadSelection {
    5050
    51     private JTextField[] latlon = null;
     51    private JosmTextField[] latlon = null;
    5252    private final JTextArea tfOsmUrl = new JTextArea();
    5353    private final JTextArea showUrl = new JTextArea();
    5454    private DownloadDialog parent;
     
    6262    }
    6363
    6464    protected void buildDownloadAreaInputFields() {
    65         latlon = new JTextField[4];
     65        latlon = new JosmTextField[4];
    6666        for(int i=0; i< 4; i++) {
    67             latlon[i] = new JTextField(11);
    68             latlon[i].setMinimumSize(new Dimension(100,new JTextField().getMinimumSize().height));
     67            latlon[i] = new JosmTextField(11);
     68            latlon[i].setMinimumSize(new Dimension(100,new JosmTextField().getMinimumSize().height));
    6969            latlon[i].addFocusListener(new SelectAllOnFocusHandler(latlon[i]));
    7070        }
    7171        LatValueChecker latChecker = new LatValueChecker(latlon[0]);
     
    190190        latlon[1].setText(area.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES));
    191191        latlon[2].setText(area.getMax().latToString(CoordinateFormat.DECIMAL_DEGREES));
    192192        latlon[3].setText(area.getMax().lonToString(CoordinateFormat.DECIMAL_DEGREES));
    193         for (JTextField tf: latlon) {
     193        for (JosmTextField tf: latlon) {
    194194            resetErrorMessage(tf);
    195195        }
    196196    }
     
    202202
    203203    private Border errorBorder = BorderFactory.createLineBorder(Color.RED, 1);
    204204
    205     protected void setErrorMessage(JTextField tf, String msg) {
     205    protected void setErrorMessage(JosmTextField tf, String msg) {
    206206        tf.setBorder(errorBorder);
    207207        tf.setToolTipText(msg);
    208208    }
    209209
    210     protected void resetErrorMessage(JTextField tf) {
     210    protected void resetErrorMessage(JosmTextField tf) {
    211211        tf.setBorder(UIManager.getBorder("TextField.border"));
    212212        tf.setToolTipText("");
    213213    }
    214214
    215215    class LatValueChecker extends FocusAdapter implements ActionListener{
    216         private JTextField tfLatValue;
     216        private JosmTextField tfLatValue;
    217217
    218         public LatValueChecker(JTextField tfLatValue) {
     218        public LatValueChecker(JosmTextField tfLatValue) {
    219219            this.tfLatValue = tfLatValue;
    220220        }
    221221
     
    245245    }
    246246
    247247    class LonValueChecker extends FocusAdapter implements ActionListener {
    248         private JTextField tfLonValue;
     248        private JosmTextField tfLonValue;
    249249
    250         public LonValueChecker(JTextField tfLonValue) {
     250        public LonValueChecker(JosmTextField tfLonValue) {
    251251            this.tfLonValue = tfLonValue;
    252252        }
    253253
  • src/org/openstreetmap/josm/gui/download/PlaceSelection.java

     
    6060import org.xml.sax.InputSource;
    6161import org.xml.sax.SAXException;
    6262import org.xml.sax.helpers.DefaultHandler;
     63import org.openstreetmap.josm.gui.widgets.JosmTextField;
    6364
    6465public class PlaceSelection implements DownloadSelection {
    6566    private static final String HISTORY_KEY = "download.places.history";
     
    7273    private DownloadDialog parent;
    7374    private final static Server[] servers = new Server[]{
    7475        new Server("Nominatim","http://nominatim.openstreetmap.org/search?format=xml&q=",tr("Class Type"),tr("Bounds")),
    75         //new Server("Namefinder","http://gazetteer.openstreetmap.org/namefinder/search.xml?find=",tr("Near"),trc("placeselection", "Zoom"))
     76        new Server("MapQuest","http://open.mapquestapi.com/nominatim/v1/search.php?format=xml&limit=50&q=",tr("Class Type"),tr("Bounds")),
     77        //new Server("Namefinder","http://gazetteer.openstreetmap.org/namefinder/search.xml?find=",tr("Near"),tr("placeselection", "Zoom")),
    7678    };
    7779    private final JosmComboBox server = new JosmComboBox(servers);
    7880
  • src/org/openstreetmap/josm/gui/download/DownloadObjectDialog.java

     
    2121import javax.swing.JLabel;
    2222import javax.swing.JOptionPane;
    2323import javax.swing.JPanel;
    24 import javax.swing.JTextField;
    2524import javax.swing.KeyStroke;
    2625import javax.swing.border.EtchedBorder;
    2726import javax.swing.plaf.basic.BasicComboBoxEditor;
     
    3534import org.openstreetmap.josm.gui.widgets.OsmIdTextField;
    3635import org.openstreetmap.josm.gui.widgets.OsmPrimitiveTypesComboBox;
    3736import org.openstreetmap.josm.tools.Utils;
     37import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3838
    3939/**
    4040 * Dialog prompt to user to let him choose OSM primitives to download by specifying their type and IDs
     
    8181       
    8282        cbId.setEditor(new BasicComboBoxEditor() {
    8383            @Override
    84             protected JTextField createEditorComponent() {
     84            protected JosmTextField createEditorComponent() {
    8585                return tfId;
    8686            }
    8787        });
  • src/org/openstreetmap/josm/gui/MainApplet.java

     
    2222import javax.swing.JOptionPane;
    2323import javax.swing.JPanel;
    2424import javax.swing.JPasswordField;
    25 import javax.swing.JTextField;
    2625
    2726import org.openstreetmap.josm.Main;
    2827import org.openstreetmap.josm.actions.JosmAction;
     
    3231import org.openstreetmap.josm.tools.GBC;
    3332import org.openstreetmap.josm.tools.I18n;
    3433import org.openstreetmap.josm.tools.Shortcut;
     34import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3535
    3636public class MainApplet extends JApplet {
    3737
     
    113113                JPanel p = new JPanel(new GridBagLayout());
    114114                p.add(new JLabel(tr(e.realm)), GBC.eol().fill(GBC.HORIZONTAL));
    115115                p.add(new JLabel(tr("Username")), GBC.std().insets(0,0,20,0));
    116                 JTextField user = new JTextField(username == null ? "" : username);
     116                JosmTextField user = new JosmTextField(username == null ? "" : username);
    117117                p.add(user, GBC.eol().fill(GBC.HORIZONTAL));
    118118                p.add(new JLabel(tr("Password")), GBC.std().insets(0,0,20,0));
    119119                JPasswordField pass = new JosmPasswordField(password == null ? "" : password);
  • src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

     
    5252import javax.swing.JScrollPane;
    5353import javax.swing.JSeparator;
    5454import javax.swing.JSlider;
    55 import javax.swing.JTextField;
    5655import javax.swing.ListSelectionModel;
    5756import javax.swing.SwingConstants;
    5857import javax.swing.event.ChangeEvent;
     
    8079import org.openstreetmap.josm.tools.ImageProvider;
    8180import org.openstreetmap.josm.tools.PrimaryDateParser;
    8281import org.xml.sax.SAXException;
     82import org.openstreetmap.josm.gui.widgets.JosmTextField;
    8383
    8484/** This class displays the window to select the GPX file and the offset (timezone + delta).
    8585 * Then it correlates the images of the layer with that GPX file.
     
    118118    Vector<GpxDataWrapper> gpxLst = new Vector<GpxDataWrapper>();
    119119    JPanel outerPanel;
    120120    JosmComboBox cbGpx;
    121     JTextField tfTimezone;
    122     JTextField tfOffset;
     121    JosmTextField tfTimezone;
     122    JosmTextField tfOffset;
    123123    JCheckBox cbExifImg;
    124124    JCheckBox cbTaggedImg;
    125125    JCheckBox cbShowThumbs;
     
    223223    private class SetOffsetActionListener implements ActionListener {
    224224        JPanel panel;
    225225        JLabel lbExifTime;
    226         JTextField tfGpsTime;
     226        JosmTextField tfGpsTime;
    227227        JosmComboBox cbTimezones;
    228228        ImageDisplay imgDisp;
    229229        JList imgList;
     
    268268            gc.anchor = GridBagConstraints.WEST;
    269269            panelTf.add(new JLabel(tr("Gps time (read from the above photo): ")), gc);
    270270
    271             tfGpsTime = new JTextField(12);
     271            tfGpsTime = new JosmTextField(12);
    272272            tfGpsTime.setEnabled(false);
    273273            tfGpsTime.setMinimumSize(new Dimension(155, tfGpsTime.getMinimumSize().height));
    274274            gc.gridx = 1;
     
    494494            timezone = 0;
    495495        }
    496496
    497         tfTimezone = new JTextField(10);
     497        tfTimezone = new JosmTextField(10);
    498498        tfTimezone.setText(formatTimezone(timezone));
    499499
    500500        try {
     
    504504        }
    505505        delta = delta / 1000;  // milliseconds -> seconds
    506506
    507         tfOffset = new JTextField(10);
     507        tfOffset = new JosmTextField(10);
    508508        tfOffset.setText(Long.toString(delta));
    509509
    510510        JButton buttonViewGpsPhoto = new JButton(tr("<html>Use photo of an accurate clock,<br>"
  • src/org/openstreetmap/josm/gui/tagging/TaggingPresetSearchDialog.java

     
    3030import javax.swing.JList;
    3131import javax.swing.JPanel;
    3232import javax.swing.JScrollPane;
    33 import javax.swing.JTextField;
    3433import javax.swing.event.DocumentEvent;
    3534import javax.swing.event.DocumentListener;
    3635
     
    4948import org.openstreetmap.josm.gui.tagging.TaggingPreset.PresetType;
    5049import org.openstreetmap.josm.gui.tagging.TaggingPreset.Role;
    5150import org.openstreetmap.josm.gui.tagging.TaggingPreset.Roles;
     51import org.openstreetmap.josm.gui.widgets.JosmTextField;
    5252
     53
    5354public class TaggingPresetSearchDialog extends ExtendedDialog implements SelectionChangedListener {
    5455
    5556    private static final int CLASSIFICATION_IN_FAVORITES = 300;
     
    191192        return instance;
    192193    }
    193194
    194     private JTextField edSearchText;
     195    private JosmTextField edSearchText;
    195196    private JList lsResult;
    196197    private JCheckBox ckOnlyApplicable;
    197198    private JCheckBox ckSearchInTags;
     
    238239        JPanel content = new JPanel();
    239240        content.setLayout(new BorderLayout());
    240241
    241         edSearchText = new JTextField();
     242        edSearchText = new JosmTextField();
    242243        edSearchText.getDocument().addDocumentListener(new DocumentListener() {
    243244
    244245            @Override
  • src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java

     
    1010
    1111import javax.swing.ComboBoxEditor;
    1212import javax.swing.JTable;
    13 import javax.swing.JTextField;
    1413import javax.swing.event.CellEditorListener;
    1514import javax.swing.table.TableCellEditor;
    1615import javax.swing.text.AttributeSet;
     
    2120
    2221import org.openstreetmap.josm.Main;
    2322import org.openstreetmap.josm.gui.util.TableCellEditorSupport;
     23import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2424
     25
    2526/**
    2627 * AutoCompletingTextField is an text field with autocompletion behaviour. It
    2728 * can be used as table cell editor in {@link JTable}s.
     
    3132 *
    3233 *
    3334 */
    34 public class AutoCompletingTextField extends JTextField implements ComboBoxEditor, TableCellEditor {
     35public class AutoCompletingTextField extends JosmTextField implements ComboBoxEditor, TableCellEditor {
    3536
    3637    private Integer maxChars;
    3738   
  • src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

     
    4545import javax.swing.JOptionPane;
    4646import javax.swing.JPanel;
    4747import javax.swing.JScrollPane;
    48 import javax.swing.JTextField;
    4948import javax.swing.JToggleButton;
    5049import javax.swing.ListCellRenderer;
    5150import javax.swing.ListModel;
     
    9190import org.openstreetmap.josm.tools.template_engine.TemplateEntry;
    9291import org.openstreetmap.josm.tools.template_engine.TemplateParser;
    9392import org.xml.sax.SAXException;
     93import org.openstreetmap.josm.gui.widgets.JosmTextField;
    9494
     95
    9596/**
    9697 * This class read encapsulate one tagging preset. A class method can
    9798 * read in all predefined presets, either shipped with JOSM or that are
     
    521522        private static String getValue(Component comp) {
    522523            if (comp instanceof JosmComboBox) {
    523524                return ((JosmComboBox) comp).getEditor().getItem().toString();
    524             } else if (comp instanceof JTextField) {
    525                 return ((JTextField) comp).getText();
     525            } else if (comp instanceof JosmTextField) {
     526                return ((JosmTextField) comp).getText();
    526527            } else if (comp instanceof JPanel) {
    527528                return getValue(((JPanel)comp).getComponent(0));
    528529            } else {
  • src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java

     
    2424import javax.swing.JPanel;
    2525import javax.swing.JRadioButton;
    2626import javax.swing.JScrollPane;
    27 import javax.swing.JTextField;
    2827import javax.swing.text.JTextComponent;
    2928
    3029import org.openstreetmap.josm.Main;
     
    3837import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel;
    3938import org.openstreetmap.josm.io.ChangesetQuery;
    4039import org.openstreetmap.josm.tools.CheckParameterUtil;
     40import org.openstreetmap.josm.gui.widgets.JosmTextField;
    4141
     42
    4243/**
    4344 * This panel allows to specify a changeset query
    4445 *
     
    374375        private JRadioButton rbRestrictToMyself;
    375376        private JRadioButton rbRestrictToUid;
    376377        private JRadioButton rbRestrictToUserName;
    377         private JTextField tfUid;
     378        private JosmTextField tfUid;
    378379        private UidInputFieldValidator valUid;
    379         private JTextField tfUserName;
     380        private JosmTextField tfUserName;
    380381        private UserNameInputValidator valUserName;
    381382        private JMultilineLabel lblRestrictedToMyself;
    382383
     
    389390            pnl.add(new JLabel(tr("User ID:")), gc);
    390391
    391392            gc.gridx = 1;
    392             pnl.add(tfUid = new JTextField(10),gc);
     393            pnl.add(tfUid = new JosmTextField(10),gc);
    393394            SelectAllOnFocusGainedDecorator.decorate(tfUid);
    394395            valUid = UidInputFieldValidator.decorate(tfUid);
    395396
     
    409410            pnl.add(new JLabel(tr("User name:")), gc);
    410411
    411412            gc.gridx = 1;
    412             pnl.add(tfUserName = new JTextField(10),gc);
     413            pnl.add(tfUserName = new JosmTextField(10),gc);
    413414            SelectAllOnFocusGainedDecorator.decorate(tfUserName);
    414415            valUserName = UserNameInputValidator.decorate(tfUserName);
    415416
     
    634635
    635636        private JRadioButton rbClosedAfter;
    636637        private JRadioButton rbClosedAfterAndCreatedBefore;
    637         private JTextField tfClosedAfterDate1;
     638        private JosmTextField tfClosedAfterDate1;
    638639        private DateValidator valClosedAfterDate1;
    639         private JTextField tfClosedAfterTime1;
     640        private JosmTextField tfClosedAfterTime1;
    640641        private TimeValidator valClosedAfterTime1;
    641         private JTextField tfClosedAfterDate2;
     642        private JosmTextField tfClosedAfterDate2;
    642643        private DateValidator valClosedAfterDate2;
    643         private JTextField tfClosedAfterTime2;
     644        private JosmTextField tfClosedAfterTime2;
    644645        private TimeValidator valClosedAfterTime2;
    645         private JTextField tfCreatedBeforeDate;
     646        private JosmTextField tfCreatedBeforeDate;
    646647        private DateValidator valCreatedBeforeDate;
    647         private JTextField tfCreatedBeforeTime;
     648        private JosmTextField tfCreatedBeforeTime;
    648649        private TimeValidator valCreatedBeforeTime;
    649650
    650651        protected JPanel buildClosedAfterInputPanel() {
     
    657658
    658659            gc.gridx = 1;
    659660            gc.weightx = 0.7;
    660             pnl.add(tfClosedAfterDate1 = new JTextField(),gc);
     661            pnl.add(tfClosedAfterDate1 = new JosmTextField(),gc);
    661662            SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterDate1);
    662663            valClosedAfterDate1 = DateValidator.decorate(tfClosedAfterDate1);
    663664            tfClosedAfterDate1.setToolTipText(valClosedAfterDate1.getStandardTooltipTextAsHtml());
     
    668669
    669670            gc.gridx = 3;
    670671            gc.weightx = 0.3;
    671             pnl.add(tfClosedAfterTime1 = new JTextField(),gc);
     672            pnl.add(tfClosedAfterTime1 = new JosmTextField(),gc);
    672673            SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterTime1);
    673674            valClosedAfterTime1 = TimeValidator.decorate(tfClosedAfterTime1);
    674675            tfClosedAfterTime1.setToolTipText(valClosedAfterTime1.getStandardTooltipTextAsHtml());
     
    691692
    692693            gc.gridx = 2;
    693694            gc.weightx = 0.7;
    694             pnl.add(tfClosedAfterDate2 = new JTextField(),gc);
     695            pnl.add(tfClosedAfterDate2 = new JosmTextField(),gc);
    695696            SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterDate2);
    696697            valClosedAfterDate2 = DateValidator.decorate(tfClosedAfterDate2);
    697698            tfClosedAfterDate2.setToolTipText(valClosedAfterDate2.getStandardTooltipTextAsHtml());
     
    701702
    702703            gc.gridx = 4;
    703704            gc.weightx = 0.3;
    704             pnl.add(tfClosedAfterTime2 = new JTextField(),gc);
     705            pnl.add(tfClosedAfterTime2 = new JosmTextField(),gc);
    705706            SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterTime2);
    706707            valClosedAfterTime2 = TimeValidator.decorate(tfClosedAfterTime2);
    707708            tfClosedAfterTime2.setToolTipText(valClosedAfterTime2.getStandardTooltipTextAsHtml());
     
    721722
    722723            gc.gridx = 2;
    723724            gc.weightx = 0.7;
    724             pnl.add(tfCreatedBeforeDate = new JTextField(),gc);
     725            pnl.add(tfCreatedBeforeDate = new JosmTextField(),gc);
    725726            SelectAllOnFocusGainedDecorator.decorate(tfCreatedBeforeDate);
    726727            valCreatedBeforeDate = DateValidator.decorate(tfCreatedBeforeDate);
    727728            tfCreatedBeforeDate.setToolTipText(valCreatedBeforeDate.getStandardTooltipTextAsHtml());
     
    732733
    733734            gc.gridx = 4;
    734735            gc.weightx = 0.3;
    735             pnl.add(tfCreatedBeforeTime = new JTextField(),gc);
     736            pnl.add(tfCreatedBeforeTime = new JosmTextField(),gc);
    736737            SelectAllOnFocusGainedDecorator.decorate(tfCreatedBeforeTime);
    737738            valCreatedBeforeTime = TimeValidator.decorate(tfCreatedBeforeTime);
    738739            tfCreatedBeforeTime.setToolTipText(valCreatedBeforeDate.getStandardTooltipTextAsHtml());
  • src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java

     
    1515import javax.swing.BorderFactory;
    1616import javax.swing.JLabel;
    1717import javax.swing.JPanel;
    18 import javax.swing.JTextField;
    1918import javax.swing.event.DocumentEvent;
    2019import javax.swing.event.DocumentListener;
    2120import javax.swing.event.HyperlinkEvent;
     
    2625import org.openstreetmap.josm.io.OsmApi;
    2726import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlException;
    2827import org.openstreetmap.josm.tools.ImageProvider;
     28import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2929
    3030
    3131public class UrlBasedQueryPanel extends JPanel {
    3232
    33     private JTextField tfUrl;
     33    private JosmTextField tfUrl;
    3434    private JLabel lblValid;
    3535
    3636    protected JPanel buildURLPanel() {
     
    4444        gc.gridx = 1;
    4545        gc.weightx = 1.0;
    4646        gc.fill = GridBagConstraints.HORIZONTAL;
    47         pnl.add(tfUrl = new JTextField(), gc);
     47        pnl.add(tfUrl = new JosmTextField(), gc);
    4848        tfUrl.getDocument().addDocumentListener(new ChangetQueryUrlValidator());
    4949        tfUrl.addFocusListener(
    5050                new FocusAdapter() {
  • src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java

     
    2626import javax.swing.JOptionPane;
    2727import javax.swing.JPanel;
    2828import javax.swing.JTextArea;
    29 import javax.swing.JTextField;
    3029import javax.swing.JToolBar;
    3130
    3231import org.openstreetmap.josm.Main;
     
    4039import org.openstreetmap.josm.gui.help.HelpUtil;
    4140import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    4241import org.openstreetmap.josm.tools.ImageProvider;
     42import org.openstreetmap.josm.gui.widgets.JosmTextField;
    4343
     44
    4445/**
    4546 * This panel displays the properties of the currently selected changeset in the
    4647 * {@link ChangesetCacheManager}.
     
    4849 */
    4950public class ChangesetDetailPanel extends JPanel implements PropertyChangeListener{
    5051
    51     private JTextField tfID;
     52    private JosmTextField tfID;
    5253    private JTextArea taComment;
    53     private JTextField tfOpen;
    54     private JTextField tfUser;
    55     private JTextField tfCreatedOn;
    56     private JTextField tfClosedOn;
     54    private JosmTextField tfOpen;
     55    private JosmTextField tfUser;
     56    private JosmTextField tfCreatedOn;
     57    private JosmTextField tfClosedOn;
    5758    private DonwloadChangesetContentAction actDownloadChangesetContent;
    5859    private UpdateChangesetAction actUpdateChangesets;
    5960    private RemoveFromCacheAction actRemoveFromCache;
     
    117118        gc.fill = GridBagConstraints.HORIZONTAL;
    118119        gc.weightx = 0.0;
    119120        gc.gridx = 1;
    120         pnl.add(tfID = new JTextField(10), gc);
     121        pnl.add(tfID = new JosmTextField(10), gc);
    121122        tfID.setEditable(false);
    122123
    123124        //-- comment
     
    144145
    145146        gc.fill = GridBagConstraints.HORIZONTAL;
    146147        gc.gridx = 1;
    147         pnl.add(tfOpen= new JTextField(10), gc);
     148        pnl.add(tfOpen= new JosmTextField(10), gc);
    148149        tfOpen.setEditable(false);
    149150
    150151        //-- Created by:
     
    157158        gc.fill = GridBagConstraints.HORIZONTAL;
    158159        gc.weightx = 1.0;
    159160        gc.gridx = 1;
    160         pnl.add(tfUser= new JTextField(""), gc);
     161        pnl.add(tfUser= new JosmTextField(""), gc);
    161162        tfUser.setEditable(false);
    162163
    163164        //-- Created On:
     
    169170
    170171        gc.fill = GridBagConstraints.HORIZONTAL;
    171172        gc.gridx = 1;
    172         pnl.add(tfCreatedOn= new JTextField(20), gc);
     173        pnl.add(tfCreatedOn= new JosmTextField(20), gc);
    173174        tfCreatedOn.setEditable(false);
    174175
    175176        //-- Closed On:
     
    181182
    182183        gc.fill = GridBagConstraints.HORIZONTAL;
    183184        gc.gridx = 1;
    184         pnl.add(tfClosedOn= new JTextField(20), gc);
     185        pnl.add(tfClosedOn= new JosmTextField(20), gc);
    185186        tfClosedOn.setEditable(false);
    186187
    187188        return pnl;
  • src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

     
    3434import javax.swing.JPopupMenu;
    3535import javax.swing.JSlider;
    3636import javax.swing.JTable;
    37 import javax.swing.JTextField;
    3837import javax.swing.JViewport;
    3938import javax.swing.KeyStroke;
    4039import javax.swing.ListSelectionModel;
     
    7170import org.openstreetmap.josm.tools.MultikeyShortcutAction;
    7271import org.openstreetmap.josm.tools.MultikeyShortcutAction.MultikeyInfo;
    7372import org.openstreetmap.josm.tools.Shortcut;
     73import org.openstreetmap.josm.gui.widgets.JosmTextField;
    7474
    7575/**
    7676 * This is a toggle dialog which displays the list of layers. Actions allow to
     
    193193        layerList.getColumnModel().getColumn(1).setPreferredWidth(16);
    194194        layerList.getColumnModel().getColumn(1).setResizable(false);
    195195        layerList.getColumnModel().getColumn(2).setCellRenderer(new LayerNameCellRenderer());
    196         layerList.getColumnModel().getColumn(2).setCellEditor(new LayerNameCellEditor(new JTextField()));
     196        layerList.getColumnModel().getColumn(2).setCellEditor(new LayerNameCellEditor(new JosmTextField()));
    197197        for (KeyStroke ks : new KeyStroke[] {
    198198                KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
    199199                KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
     
    10081008    }
    10091009
    10101010    private static class LayerNameCellEditor extends DefaultCellEditor {
    1011         public LayerNameCellEditor(JTextField tf) {
     1011        public LayerNameCellEditor(JosmTextField tf) {
    10121012            super(tf);
    10131013        }
    10141014
    10151015        @Override
    10161016        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    1017             JTextField tf = (JTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column);
     1017            JosmTextField tf = (JosmTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column);
    10181018            tf.setText(value == null ? "" : ((Layer) value).getName());
    10191019            return tf;
    10201020        }
  • src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

     
    2626import javax.swing.JPanel;
    2727import javax.swing.JPopupMenu;
    2828import javax.swing.JScrollPane;
    29 import javax.swing.JTextField;
    3029import javax.swing.KeyStroke;
    3130import javax.swing.ListSelectionModel;
    3231import javax.swing.SwingUtilities;
     
    7574import org.openstreetmap.josm.tools.Predicate;
    7675import org.openstreetmap.josm.tools.Shortcut;
    7776import org.openstreetmap.josm.tools.Utils;
     77import org.openstreetmap.josm.gui.widgets.JosmTextField;
    7878
    7979/**
    8080 * A dialog showing all known relations, with buttons to add, edit, and
     
    9595    private final JPopupMenu popupMenu = new JPopupMenu();
    9696    private final PopupMenuHandler popupMenuHandler = new PopupMenuHandler(popupMenu);
    9797
    98     private final JTextField filter;
     98    private final JosmTextField filter;
    9999   
    100100    // Actions
    101101    /** the edit action */
     
    259259        }
    260260    }
    261261
    262     private JTextField  setupFilter() {
    263         final JTextField f = new DisableShortcutsOnFocusGainedTextField();
     262    private JosmTextField  setupFilter() {
     263        final JosmTextField f = new DisableShortcutsOnFocusGainedTextField();
    264264        f.setToolTipText(tr("Relation list filter"));
    265265        f.getDocument().addDocumentListener(new DocumentListener() {
    266266
  • src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java

     
    2525import javax.swing.JPanel;
    2626import javax.swing.JSeparator;
    2727import javax.swing.JTabbedPane;
    28 import javax.swing.JTextField;
    2928import javax.swing.UIManager;
    3029import javax.swing.event.ChangeEvent;
    3130import javax.swing.event.ChangeListener;
    3231import javax.swing.event.DocumentEvent;
    3332import javax.swing.event.DocumentListener;
    3433
     34import org.openstreetmap.josm.gui.widgets.JosmTextField;
     35
    3536import org.openstreetmap.josm.Main;
    3637import org.openstreetmap.josm.data.coor.CoordinateFormat;
    3738import org.openstreetmap.josm.data.coor.EastNorth;
     
    4647    private static final Color BG_COLOR_ERROR = new Color(255,224,224);
    4748
    4849    public JTabbedPane tabs;
    49     private JTextField tfLatLon, tfEastNorth;
     50    private JosmTextField tfLatLon, tfEastNorth;
    5051    private LatLon latLonCoordinates;
    5152    private EastNorth eastNorthCoordinates;
    5253
     
    7677        pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    7778
    7879        pnl.add(new JLabel(tr("Coordinates:")), GBC.std().insets(0,10,5,0));
    79         tfLatLon = new JTextField(24);
     80        tfLatLon = new JosmTextField(24);
    8081        pnl.add(tfLatLon, GBC.eol().insets(0,10,0,0).fill(GBC.HORIZONTAL).weight(1.0, 0.0));
    8182
    8283        pnl.add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL).insets(0,5,0,5));
     
    128129        pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    129130
    130131        pnl.add(new JLabel(tr("Projected coordinates:")), GBC.std().insets(0,10,5,0));
    131         tfEastNorth = new JTextField(24);
     132        tfEastNorth = new JosmTextField(24);
    132133
    133134        pnl.add(tfEastNorth, GBC.eol().insets(0,10,0,0).fill(GBC.HORIZONTAL).weight(1.0, 0.0));
    134135
     
    207208        return eastNorthCoordinates;
    208209    }
    209210
    210     protected void setErrorFeedback(JTextField tf, String message) {
     211    protected void setErrorFeedback(JosmTextField tf, String message) {
    211212        tf.setBorder(BorderFactory.createLineBorder(Color.RED, 1));
    212213        tf.setToolTipText(message);
    213214        tf.setBackground(BG_COLOR_ERROR);
    214215    }
    215216
    216     protected void clearErrorFeedback(JTextField tf, String message) {
     217    protected void clearErrorFeedback(JosmTextField tf, String message) {
    217218        tf.setBorder(UIManager.getBorder("TextField.border"));
    218219        tf.setToolTipText(message);
    219220        tf.setBackground(UIManager.getColor("TextField.background"));
     
    328329    static class TextFieldFocusHandler implements FocusListener {
    329330        public void focusGained(FocusEvent e) {
    330331            Component c = e.getComponent();
    331             if (c instanceof JTextField) {
    332                 JTextField tf = (JTextField)c;
     332            if (c instanceof JosmTextField) {
     333                JosmTextField tf = (JosmTextField)c;
    333334                tf.selectAll();
    334335            }
    335336        }
  • src/org/openstreetmap/josm/io/GpxExporter.java

     
    2222import javax.swing.JPanel;
    2323import javax.swing.JScrollPane;
    2424import javax.swing.JTextArea;
    25 import javax.swing.JTextField;
    2625import javax.swing.ListSelectionModel;
    2726
    2827import org.openstreetmap.josm.Main;
     
    3332import org.openstreetmap.josm.gui.layer.GpxLayer;
    3433import org.openstreetmap.josm.gui.layer.Layer;
    3534import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     35import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3636import org.openstreetmap.josm.tools.CheckParameterUtil;
    3737import org.openstreetmap.josm.tools.GBC;
    3838import org.openstreetmap.josm.tools.Utils;
     
    9090        p.add(author, GBC.eol());
    9191        JLabel nameLabel = new JLabel(tr("Real name"));
    9292        p.add(nameLabel, GBC.std().insets(10, 0, 5, 0));
    93         JTextField authorName = new JTextField();
     93        JosmTextField authorName = new JosmTextField();
    9494        p.add(authorName, GBC.eol().fill(GBC.HORIZONTAL));
    9595        JLabel emailLabel = new JLabel(tr("E-Mail"));
    9696        p.add(emailLabel, GBC.std().insets(10, 0, 5, 0));
    97         JTextField email = new JTextField();
     97        JosmTextField email = new JosmTextField();
    9898        p.add(email, GBC.eol().fill(GBC.HORIZONTAL));
    9999        JLabel copyrightLabel = new JLabel(tr("Copyright (URL)"));
    100100        p.add(copyrightLabel, GBC.std().insets(10, 0, 5, 0));
    101         JTextField copyright = new JTextField();
     101        JosmTextField copyright = new JosmTextField();
    102102        p.add(copyright, GBC.std().fill(GBC.HORIZONTAL));
    103103        JButton predefined = new JButton(tr("Predefined"));
    104104        p.add(predefined, GBC.eol().insets(5, 0, 0, 0));
    105105        JLabel copyrightYearLabel = new JLabel(tr("Copyright year"));
    106106        p.add(copyrightYearLabel, GBC.std().insets(10, 0, 5, 5));
    107         JTextField copyrightYear = new JTextField("");
     107        JosmTextField copyrightYear = new JosmTextField("");
    108108        p.add(copyrightYear, GBC.eol().fill(GBC.HORIZONTAL));
    109109        JLabel warning = new JLabel("<html><font size='-2'>&nbsp;</html");
    110110        p.add(warning, GBC.eol().fill(GBC.HORIZONTAL).insets(15, 0, 0, 0));
     
    112112                copyrightLabel, copyrightYearLabel, warning);
    113113
    114114        p.add(new JLabel(tr("Keywords")), GBC.eol());
    115         JTextField keywords = new JTextField();
     115        JosmTextField keywords = new JosmTextField();
    116116        keywords.setText((String) gpxData.attr.get(META_KEYWORDS));
    117117        p.add(keywords, GBC.eop().fill(GBC.HORIZONTAL));
    118118
     
    183183        }
    184184    }
    185185
    186     private static void enableCopyright(final GpxData data, final JTextField copyright, final JButton predefined,
    187             final JTextField copyrightYear, final JLabel copyrightLabel, final JLabel copyrightYearLabel,
     186    private static void enableCopyright(final GpxData data, final JosmTextField copyright, final JButton predefined,
     187            final JosmTextField copyrightYear, final JLabel copyrightLabel, final JLabel copyrightYearLabel,
    188188            final JLabel warning, boolean enable) {
    189189        copyright.setEnabled(enable);
    190190        predefined.setEnabled(enable);
     
    226226    private static void addDependencies(
    227227            final GpxData data,
    228228            final JCheckBox author,
    229             final JTextField authorName,
    230             final JTextField email,
    231             final JTextField copyright,
     229            final JosmTextField authorName,
     230            final JosmTextField email,
     231            final JosmTextField copyright,
    232232            final JButton predefined,
    233             final JTextField copyrightYear,
     233            final JosmTextField copyrightYear,
    234234            final JLabel nameLabel,
    235235            final JLabel emailLabel,
    236236            final JLabel copyrightLabel,
  • src/org/openstreetmap/josm/io/session/OsmDataSessionExporter.java

     
    3131import javax.swing.JLabel;
    3232import javax.swing.JPanel;
    3333import javax.swing.JRadioButton;
    34 import javax.swing.JTextField;
    3534import javax.swing.SwingConstants;
    3635
    3736import org.w3c.dom.Element;
     
    4039import org.openstreetmap.josm.gui.layer.Layer;
    4140import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    4241import org.openstreetmap.josm.gui.util.GuiHelper;
     42import org.openstreetmap.josm.gui.widgets.JosmTextField;
    4343import org.openstreetmap.josm.io.OsmWriter;
    4444import org.openstreetmap.josm.io.OsmWriterFactory;
    4545import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport;
     
    108108        final LayerSaveAction saveAction = new LayerSaveAction();
    109109        final JButton save = new JButton(saveAction);
    110110        if (file != null) {
    111             JTextField tf = new JTextField();
     111            JosmTextField tf = new JosmTextField();
    112112            tf.setText(file.getPath());
    113113            tf.setEditable(false);
    114114            cardLink.add(tf, GBC.std());
  • src/org/openstreetmap/josm/io/session/GpxTracksSessionExporter.java

     
    2929import javax.swing.JLabel;
    3030import javax.swing.JPanel;
    3131import javax.swing.JRadioButton;
    32 import javax.swing.JTextField;
    3332import javax.swing.SwingConstants;
    3433
    3534import org.openstreetmap.josm.gui.layer.GpxLayer;
    3635import org.openstreetmap.josm.gui.layer.Layer;
    3736import org.openstreetmap.josm.gui.util.GuiHelper;
     37import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3838import org.openstreetmap.josm.io.GpxWriter;
    3939import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport;
    4040import org.openstreetmap.josm.tools.GBC;
     
    7878        JPanel cardLink = new JPanel(new GridBagLayout());
    7979        final File file = layer.getAssociatedFile();
    8080        if (file != null) {
    81             JTextField tf = new JTextField();
     81            JosmTextField tf = new JosmTextField();
    8282            tf.setText(file.getPath());
    8383            tf.setEditable(false);
    8484            cardLink.add(tf, GBC.std());
  • src/org/openstreetmap/josm/actions/ImageryAdjustAction.java

     
    1919
    2020import javax.swing.JLabel;
    2121import javax.swing.JPanel;
    22 import javax.swing.JTextField;
    2322
    2423import org.openstreetmap.josm.Main;
    2524import org.openstreetmap.josm.actions.mapmode.MapMode;
     
    3029import org.openstreetmap.josm.gui.layer.ImageryLayer;
    3130import org.openstreetmap.josm.tools.GBC;
    3231import org.openstreetmap.josm.tools.ImageProvider;
     32import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3333
    3434
    3535public class ImageryAdjustAction extends MapMode implements MouseListener, MouseMotionListener, AWTEventListener{
     
    148148    }
    149149
    150150    class ImageryOffsetDialog extends ExtendedDialog implements FocusListener {
    151         public final JTextField tOffset = new JTextField();
    152         JTextField tBookmarkName = new JTextField();
     151        public final JosmTextField tOffset = new JosmTextField();
     152        JosmTextField tBookmarkName = new JosmTextField();
    153153        private boolean ignoreListener;
    154154        public ImageryOffsetDialog() {
    155155            super(Main.parent,
  • src/org/openstreetmap/josm/actions/JumpToAction.java

     
    1313import javax.swing.JLabel;
    1414import javax.swing.JOptionPane;
    1515import javax.swing.JPanel;
    16 import javax.swing.JTextField;
    1716import javax.swing.event.DocumentEvent;
    1817import javax.swing.event.DocumentListener;
    1918
     
    2423import org.openstreetmap.josm.tools.GBC;
    2524import org.openstreetmap.josm.tools.OsmUrlToBounds;
    2625import org.openstreetmap.josm.tools.Shortcut;
     26import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2727
    2828public class JumpToAction extends JosmAction implements MouseListener {
    2929    public JumpToAction() {
     
    3333        Main.toolbar.register(this);
    3434    }
    3535
    36     private JTextField url = new JTextField();
    37     private JTextField lat = new JTextField();
    38     private JTextField lon = new JTextField();
    39     private JTextField zm = new JTextField();
     36    private JosmTextField url = new JosmTextField();
     37    private JosmTextField lat = new JosmTextField();
     38    private JosmTextField lon = new JosmTextField();
     39    private JosmTextField zm = new JosmTextField();
    4040
    4141    private double zoomFactor = 0;
    4242    public void showJumpToDialog() {
  • src/org/openstreetmap/josm/actions/search/SearchAction.java

     
    2929import javax.swing.JOptionPane;
    3030import javax.swing.JPanel;
    3131import javax.swing.JRadioButton;
    32 import javax.swing.JTextField;
    3332import javax.swing.text.BadLocationException;
    3433
    3534import org.openstreetmap.josm.Main;
     
    5049import org.openstreetmap.josm.tools.Property;
    5150import org.openstreetmap.josm.tools.Shortcut;
    5251import org.openstreetmap.josm.tools.Utils;
     52import org.openstreetmap.josm.gui.widgets.JosmTextField;
    5353
     54
    5455public class SearchAction extends JosmAction implements ParameterizedAction {
    5556
    5657    public static final int DEFAULT_SEARCH_HISTORY_SIZE = 15;
     
    194195                    @Override
    195196                    public void mouseClicked(MouseEvent e) {
    196197                        try {
    197                             JTextField tf = (JTextField) hcb.getEditor().getEditorComponent();
     198                            JosmTextField tf = (JosmTextField) hcb.getEditor().getEditorComponent();
    198199                            tf.getDocument().insertString(tf.getCaretPosition(), " " + insertText, null);
    199200                        } catch (BadLocationException ex) {
    200201                            throw new RuntimeException(ex.getMessage(), ex);
  • src/org/openstreetmap/josm/actions/RenameLayerAction.java

     
    1313import javax.swing.JCheckBox;
    1414import javax.swing.JDialog;
    1515import javax.swing.JOptionPane;
    16 import javax.swing.JTextField;
    1716
    1817import org.openstreetmap.josm.Main;
    1918import org.openstreetmap.josm.gui.layer.Layer;
    2019import org.openstreetmap.josm.tools.ImageProvider;
     20import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2121
    2222/**
    2323 * Action to rename an specific layer. Provides the option to rename the
     
    4343
    4444    public void actionPerformed(ActionEvent e) {
    4545        Box panel = Box.createVerticalBox();
    46         final JTextField name = new JTextField(layer.getName());
     46        final JosmTextField name = new JosmTextField(layer.getName());
    4747        panel.add(name);
    4848        JCheckBox filerename = new JCheckBox(tr("Also rename the file"));
    4949        if (Main.applet) {
  • src/org/openstreetmap/josm/actions/Map_Rectifier_WMSmenuAction.java

     
    1616import javax.swing.JOptionPane;
    1717import javax.swing.JPanel;
    1818import javax.swing.JRadioButton;
    19 import javax.swing.JTextField;
    2019
    2120import org.openstreetmap.josm.Main;
    2221import org.openstreetmap.josm.data.imagery.ImageryInfo;
     
    2625import org.openstreetmap.josm.tools.Shortcut;
    2726import org.openstreetmap.josm.tools.UrlLabel;
    2827import org.openstreetmap.josm.tools.Utils;
     28import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2929
    3030public class Map_Rectifier_WMSmenuAction extends JosmAction {
    3131    /**
     
    110110        JPanel panel = new JPanel(new GridBagLayout());
    111111        panel.add(new JLabel(tr("Supported Rectifier Services:")), GBC.eol());
    112112
    113         JTextField tfWmsUrl = new JTextField(30);
     113        JosmTextField tfWmsUrl = new JosmTextField(30);
    114114
    115115        String clip = Utils.getClipboardContent();
    116116        clip = clip == null ? "" : clip.trim();