Ticket #4429: josmtextfield_01.patch

File josmtextfield_01.patch, 50.5 KB (added by NooN, 6 years ago)
  • 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/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/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/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();
  • 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/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
     
    112112                JPanel p = new JPanel(new GridBagLayout());
    113113                p.add(new JLabel(tr(e.realm)), GBC.eol().fill(GBC.HORIZONTAL));
    114114                p.add(new JLabel(tr("Username")), GBC.std().insets(0,0,20,0));
    115                 JTextField user = new JTextField(username == null ? "" : username);
     115                JosmTextField user = new JosmTextField(username == null ? "" : username);
    116116                p.add(user, GBC.eol().fill(GBC.HORIZONTAL));
    117117                p.add(new JLabel(tr("Password")), GBC.std().insets(0,0,20,0));
    118118                JPasswordField pass = new JosmPasswordField(password == null ? "" : password);
  • 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/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/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/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/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/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/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/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());
     
    13241324    }
    13251325
    13261326    class FileOrUrlCellEditor extends JPanel implements TableCellEditor {
    1327         private JTextField tfFileName;
     1327        private JosmTextField tfFileName;
    13281328        private CopyOnWriteArrayList<CellEditorListener> listeners;
    13291329        private String value;
    13301330        private boolean isFile;
     
    13401340            gc.fill = GridBagConstraints.BOTH;
    13411341            gc.weightx = 1.0;
    13421342            gc.weighty = 1.0;
    1343             add(tfFileName = new JTextField(), gc);
     1343            add(tfFileName = new JosmTextField(), gc);
    13441344
    13451345            gc.gridx = 1;
    13461346            gc.gridy = 0;
  • 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/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/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/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/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/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";
  • 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        });