Ticket #4429: textfield.patch
File textfield.patch, 51.0 KB (added by , 12 years ago) |
---|
-
src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
58 58 import javax.swing.JScrollPane; 59 59 import javax.swing.JSeparator; 60 60 import javax.swing.JTable; 61 import javax.swing.JTextField;61 //import javax.swing.JTextField; 62 62 import javax.swing.JToolBar; 63 63 import javax.swing.KeyStroke; 64 64 import javax.swing.ListCellRenderer; … … 91 91 import org.openstreetmap.josm.tools.LanguageInfo; 92 92 import org.openstreetmap.josm.tools.Utils; 93 93 import org.xml.sax.SAXException; 94 import org.openstreetmap.josm.gui.MyTextField; 94 95 95 96 public abstract class SourceEditor extends JPanel { 96 97 … … 679 680 680 681 protected class EditSourceEntryDialog extends ExtendedDialog { 681 682 682 private JTextField tfTitle;683 private JTextField tfURL;683 private MyTextField tfTitle; 684 private MyTextField tfURL; 684 685 private JCheckBox cbActive; 685 686 686 687 public EditSourceEntryDialog(Component parent, String title, SourceEntry e) { … … 690 691 691 692 JPanel p = new JPanel(new GridBagLayout()); 692 693 693 tfTitle = new JTextField(60);694 tfTitle = new MyTextField(60); 694 695 p.add(new JLabel(tr("Name (optional):")), GBC.std().insets(15, 0, 5, 5)); 695 696 p.add(tfTitle, GBC.eol().insets(0, 0, 5, 5)); 696 697 697 tfURL = new JTextField(60);698 tfURL = new MyTextField(60); 698 699 p.add(new JLabel(tr("URL / File:")), GBC.std().insets(15, 0, 5, 0)); 699 700 p.add(tfURL, GBC.std().insets(0, 0, 5, 5)); 700 701 JButton fileChooser = new JButton(new LaunchFileChooserAction()); … … 1324 1325 } 1325 1326 1326 1327 class FileOrUrlCellEditor extends JPanel implements TableCellEditor { 1327 private JTextField tfFileName;1328 private MyTextField tfFileName; 1328 1329 private CopyOnWriteArrayList<CellEditorListener> listeners; 1329 1330 private String value; 1330 1331 private boolean isFile; … … 1340 1341 gc.fill = GridBagConstraints.BOTH; 1341 1342 gc.weightx = 1.0; 1342 1343 gc.weighty = 1.0; 1343 add(tfFileName = new JTextField(), gc);1344 add(tfFileName = new MyTextField(), gc); 1344 1345 1345 1346 gc.gridx = 1; 1346 1347 gc.gridy = 0; -
src/org/openstreetmap/josm/gui/MapStatus.java
33 33 import javax.swing.JPanel; 34 34 import javax.swing.JProgressBar; 35 35 import javax.swing.JScrollPane; 36 import javax.swing.JTextField;36 //import javax.swing.JTextField; 37 37 import javax.swing.Popup; 38 38 import javax.swing.PopupFactory; 39 39 import javax.swing.UIManager; … … 49 49 import org.openstreetmap.josm.gui.util.GuiHelper; 50 50 import org.openstreetmap.josm.tools.GBC; 51 51 import org.openstreetmap.josm.tools.ImageProvider; 52 import org.openstreetmap.josm.gui.MyTextField; 52 53 53 54 /** 54 55 * A component that manages some status information display about the map. … … 150 151 151 152 final ImageLabel lonText = new ImageLabel("lon", tr("The geographic longitude at the mouse pointer."), 11); 152 153 final ImageLabel nameText = new ImageLabel("name", tr("The name of the object at the mouse pointer."), 20); 153 final JTextField helpText = new JTextField();154 final MyTextField helpText = new MyTextField(); 154 155 final ImageLabel latText = new ImageLabel("lat", tr("The geographic latitude at the mouse pointer."), 11); 155 156 final ImageLabel angleText = new ImageLabel("angle", tr("The angle between the previous and the current way segment."), 6); 156 157 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
1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.widgets; 3 3 4 import javax.swing.JTextField;4 //import javax.swing.JTextField; 5 5 import javax.swing.text.JTextComponent; 6 6 7 import org.openstreetmap.josm.gui.MyTextField; 7 8 import org.openstreetmap.josm.tools.Utils; 8 9 9 10 /** … … 12 13 * @param <T> The ID validator class 13 14 * @since 5765 14 15 */ 15 public abstract class AbstractIdTextField<T extends AbstractTextComponentValidator> extends JTextField {16 public abstract class AbstractIdTextField<T extends AbstractTextComponentValidator> extends MyTextField { 16 17 17 18 protected final T validator; 18 19 -
src/org/openstreetmap/josm/gui/widgets/DisableShortcutsOnFocusGainedTextField.java
11 11 import javax.swing.Action; 12 12 import javax.swing.JMenu; 13 13 import javax.swing.JMenuItem; 14 import javax.swing.JTextField;14 //import javax.swing.JTextField; 15 15 import javax.swing.KeyStroke; 16 16 import javax.swing.text.Document; 17 17 … … 19 19 import org.openstreetmap.josm.actions.JosmAction; 20 20 import org.openstreetmap.josm.tools.Pair; 21 21 import org.openstreetmap.josm.tools.Shortcut; 22 import org.openstreetmap.josm.gui.MyTextField; 22 23 23 24 /** 24 25 * A JTextField that disabled all JOSM shortcuts composed of a single key without modifier (except F1 to F12), … … 26 27 * This allows to include text fields in toggle dialogs (needed for relation filter). 27 28 * @since 5696 28 29 */ 29 public class DisableShortcutsOnFocusGainedTextField extends JTextField implements FocusListener {30 public class DisableShortcutsOnFocusGainedTextField extends MyTextField implements FocusListener { 30 31 31 32 /** 32 33 * Constructs a new <code>TextField</code>. A default model is created, -
src/org/openstreetmap/josm/gui/widgets/AbstractTextComponentValidator.java
10 10 import java.beans.PropertyChangeListener; 11 11 12 12 import javax.swing.BorderFactory; 13 import javax.swing.JTextField;13 //import javax.swing.JTextField; 14 14 import javax.swing.UIManager; 15 15 import javax.swing.border.Border; 16 16 import javax.swing.event.DocumentEvent; … … 19 19 20 20 import org.openstreetmap.josm.tools.CheckParameterUtil; 21 21 import org.openstreetmap.josm.tools.Utils; 22 import org.openstreetmap.josm.gui.MyTextField; 22 23 23 24 /** 24 25 * This is an abstract class for a validator on a text component. … … 109 110 tc.getDocument().addDocumentListener(this); 110 111 } 111 112 if (addActionListener) { 112 if (tc instanceof JTextField) {113 JTextField tf = (JTextField)tc;113 if (tc instanceof MyTextField) { 114 MyTextField tf = (MyTextField)tc; 114 115 tf.addActionListener(this); 115 116 } 116 117 } -
src/org/openstreetmap/josm/gui/widgets/BoundingBoxSelectionPanel.java
18 18 import javax.swing.JLabel; 19 19 import javax.swing.JPanel; 20 20 import javax.swing.JPopupMenu; 21 import javax.swing.JTextField;21 //import javax.swing.JTextField; 22 22 import javax.swing.event.DocumentEvent; 23 23 import javax.swing.event.DocumentListener; 24 24 import javax.swing.text.JTextComponent; … … 31 31 import org.openstreetmap.josm.tools.ImageProvider; 32 32 import org.openstreetmap.josm.tools.OsmUrlToBounds; 33 33 import org.openstreetmap.josm.tools.Utils; 34 import org.openstreetmap.josm.gui.MyTextField; 34 35 35 36 /** 36 37 * … … 38 39 */ 39 40 public class BoundingBoxSelectionPanel extends JPanel { 40 41 41 private JTextField[] tfLatLon = null;42 private final JTextField tfOsmUrl = new JTextField();42 private MyTextField[] tfLatLon = null; 43 private final MyTextField tfOsmUrl = new MyTextField(); 43 44 44 45 protected void buildInputFields() { 45 tfLatLon = new JTextField[4];46 tfLatLon = new MyTextField[4]; 46 47 for(int i=0; i< 4; i++) { 47 tfLatLon[i] = new JTextField(11);48 tfLatLon[i].setMinimumSize(new Dimension(100,new JTextField().getMinimumSize().height));48 tfLatLon[i] = new MyTextField(11); 49 tfLatLon[i].setMinimumSize(new Dimension(100,new MyTextField().getMinimumSize().height)); 49 50 SelectAllOnFocusGainedDecorator.decorate(tfLatLon[i]); 50 51 } 51 52 LatitudeValidator.decorate(tfLatLon[0]); -
src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java
32 32 import javax.swing.JLabel; 33 33 import javax.swing.JPanel; 34 34 import javax.swing.JSpinner; 35 import javax.swing.JTextField;35 //import javax.swing.JTextField; 36 36 import javax.swing.KeyStroke; 37 37 import javax.swing.SpinnerNumberModel; 38 38 import javax.swing.event.ChangeEvent; … … 49 49 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 50 50 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 51 51 import org.openstreetmap.josm.tools.ImageProvider; 52 import org.openstreetmap.josm.gui.MyTextField; 52 53 53 54 /** 54 55 * TileSelectionBBoxChooser allows to select a bounding box (i.e. for downloading) based … … 209 210 static private class TileGridInputPanel extends JPanel implements PropertyChangeListener{ 210 211 static public final String TILE_BOUNDS_PROP = TileGridInputPanel.class.getName() + ".tileBounds"; 211 212 212 private JTextField tfMaxY;213 private JTextField tfMinY;214 private JTextField tfMaxX;215 private JTextField tfMinX;213 private MyTextField tfMaxY; 214 private MyTextField tfMinY; 215 private MyTextField tfMaxX; 216 private MyTextField tfMinX; 216 217 private TileCoordinateValidator valMaxY; 217 218 private TileCoordinateValidator valMinY; 218 219 private TileCoordinateValidator valMaxX; … … 266 267 267 268 gc.gridx = 1; 268 269 gc.weightx = 0.5; 269 pnl.add(tfMinX = new JTextField(), gc);270 pnl.add(tfMinX = new MyTextField(), gc); 270 271 valMinX = new TileCoordinateValidator(tfMinX); 271 272 SelectAllOnFocusGainedDecorator.decorate(tfMinX); 272 273 tfMinX.addActionListener(tileBoundsBuilder); … … 274 275 275 276 gc.gridx = 2; 276 277 gc.weightx = 0.5; 277 pnl.add(tfMaxX = new JTextField(), gc);278 pnl.add(tfMaxX = new MyTextField(), gc); 278 279 valMaxX = new TileCoordinateValidator(tfMaxX); 279 280 SelectAllOnFocusGainedDecorator.decorate(tfMaxX); 280 281 tfMaxX.addActionListener(tileBoundsBuilder); … … 287 288 288 289 gc.gridx = 1; 289 290 gc.weightx = 0.5; 290 pnl.add(tfMinY = new JTextField(), gc);291 pnl.add(tfMinY = new MyTextField(), gc); 291 292 valMinY = new TileCoordinateValidator(tfMinY); 292 293 SelectAllOnFocusGainedDecorator.decorate(tfMinY); 293 294 tfMinY.addActionListener(tileBoundsBuilder); … … 295 296 296 297 gc.gridx = 2; 297 298 gc.weightx = 0.5; 298 pnl.add(tfMaxY = new JTextField(), gc);299 pnl.add(tfMaxY = new MyTextField(), gc); 299 300 valMaxY = new TileCoordinateValidator(tfMaxY); 300 301 SelectAllOnFocusGainedDecorator.decorate(tfMaxY); 301 302 tfMaxY.addActionListener(tileBoundsBuilder); … … 427 428 428 429 static public final String TILE_BOUNDS_PROP = TileAddressInputPanel.class.getName() + ".tileBounds"; 429 430 430 private JTextField tfTileAddress;431 private MyTextField tfTileAddress; 431 432 private TileAddressValidator valTileAddress; 432 433 433 434 protected JPanel buildTextPanel() { … … 451 452 452 453 gc.weightx = 1.0; 453 454 gc.gridx = 1; 454 pnl.add(tfTileAddress = new JTextField(), gc);455 pnl.add(tfTileAddress = new MyTextField(), gc); 455 456 valTileAddress = new TileAddressValidator(tfTileAddress); 456 457 SelectAllOnFocusGainedDecorator.decorate(tfTileAddress); 457 458 -
src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellEditor.java
7 7 8 8 import javax.swing.AbstractCellEditor; 9 9 import javax.swing.JTable; 10 import javax.swing.JTextField;10 //import javax.swing.JTextField; 11 11 import javax.swing.table.TableCellEditor; 12 12 13 13 import org.openstreetmap.josm.data.osm.RelationMember; 14 import org.openstreetmap.josm.gui.MyTextField; 14 15 16 15 17 /** 16 18 * {@link TableCellEditor} for the role column in a table for {@link RelationMember}s. 17 19 * 18 20 */ 19 21 public class RelationMemberTableCellEditor extends AbstractCellEditor implements TableCellEditor{ 20 22 21 private final JTextField editor;23 private final MyTextField editor; 22 24 23 25 public RelationMemberTableCellEditor() { 24 editor = new JTextField();26 editor = new MyTextField(); 25 27 editor.addFocusListener( 26 28 new FocusAdapter() { 27 29 @Override -
src/org/openstreetmap/josm/gui/download/PlaceSelection.java
60 60 import org.xml.sax.InputSource; 61 61 import org.xml.sax.SAXException; 62 62 import org.xml.sax.helpers.DefaultHandler; 63 import org.openstreetmap.josm.gui.MyTextField; 63 64 64 65 public class PlaceSelection implements DownloadSelection { 65 66 private static final String HISTORY_KEY = "download.places.history"; -
src/org/openstreetmap/josm/gui/download/DownloadObjectDialog.java
21 21 import javax.swing.JLabel; 22 22 import javax.swing.JOptionPane; 23 23 import javax.swing.JPanel; 24 import javax.swing.JTextField;24 //import javax.swing.JTextField; 25 25 import javax.swing.KeyStroke; 26 26 import javax.swing.border.EtchedBorder; 27 27 import javax.swing.plaf.basic.BasicComboBoxEditor; … … 35 35 import org.openstreetmap.josm.gui.widgets.OsmIdTextField; 36 36 import org.openstreetmap.josm.gui.widgets.OsmPrimitiveTypesComboBox; 37 37 import org.openstreetmap.josm.tools.Utils; 38 import org.openstreetmap.josm.gui.MyTextField; 38 39 39 40 /** 40 41 * Dialog prompt to user to let him choose OSM primitives to download by specifying their type and IDs … … 81 82 82 83 cbId.setEditor(new BasicComboBoxEditor() { 83 84 @Override 84 protected JTextField createEditorComponent() {85 protected MyTextField createEditorComponent() { 85 86 return tfId; 86 87 } 87 88 }); -
src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
23 23 import javax.swing.JPanel; 24 24 import javax.swing.JPopupMenu; 25 25 import javax.swing.JTextArea; 26 import javax.swing.JTextField;26 //import javax.swing.JTextField; 27 27 import javax.swing.UIManager; 28 28 import javax.swing.border.Border; 29 29 import javax.swing.event.DocumentEvent; … … 37 37 import org.openstreetmap.josm.tools.ImageProvider; 38 38 import org.openstreetmap.josm.tools.OsmUrlToBounds; 39 39 import org.openstreetmap.josm.tools.Utils; 40 import org.openstreetmap.josm.gui.MyTextField; 40 41 41 42 /** 42 43 * Bounding box selector. … … 48 49 */ 49 50 public class BoundingBoxSelection implements DownloadSelection { 50 51 51 private JTextField[] latlon = null;52 private MyTextField[] latlon = null; 52 53 private final JTextArea tfOsmUrl = new JTextArea(); 53 54 private final JTextArea showUrl = new JTextArea(); 54 55 private DownloadDialog parent; … … 62 63 } 63 64 64 65 protected void buildDownloadAreaInputFields() { 65 latlon = new JTextField[4];66 latlon = new MyTextField[4]; 66 67 for(int i=0; i< 4; i++) { 67 latlon[i] = new JTextField(11);68 latlon[i].setMinimumSize(new Dimension(100,new JTextField().getMinimumSize().height));68 latlon[i] = new MyTextField(11); 69 latlon[i].setMinimumSize(new Dimension(100,new MyTextField().getMinimumSize().height)); 69 70 latlon[i].addFocusListener(new SelectAllOnFocusHandler(latlon[i])); 70 71 } 71 72 LatValueChecker latChecker = new LatValueChecker(latlon[0]); … … 190 191 latlon[1].setText(area.getMin().lonToString(CoordinateFormat.DECIMAL_DEGREES)); 191 192 latlon[2].setText(area.getMax().latToString(CoordinateFormat.DECIMAL_DEGREES)); 192 193 latlon[3].setText(area.getMax().lonToString(CoordinateFormat.DECIMAL_DEGREES)); 193 for ( JTextField tf: latlon) {194 for (MyTextField tf: latlon) { 194 195 resetErrorMessage(tf); 195 196 } 196 197 } … … 202 203 203 204 private Border errorBorder = BorderFactory.createLineBorder(Color.RED, 1); 204 205 205 protected void setErrorMessage( JTextField tf, String msg) {206 protected void setErrorMessage(MyTextField tf, String msg) { 206 207 tf.setBorder(errorBorder); 207 208 tf.setToolTipText(msg); 208 209 } 209 210 210 protected void resetErrorMessage( JTextField tf) {211 protected void resetErrorMessage(MyTextField tf) { 211 212 tf.setBorder(UIManager.getBorder("TextField.border")); 212 213 tf.setToolTipText(""); 213 214 } 214 215 215 216 class LatValueChecker extends FocusAdapter implements ActionListener{ 216 private JTextField tfLatValue;217 private MyTextField tfLatValue; 217 218 218 public LatValueChecker( JTextField tfLatValue) {219 public LatValueChecker(MyTextField tfLatValue) { 219 220 this.tfLatValue = tfLatValue; 220 221 } 221 222 … … 245 246 } 246 247 247 248 class LonValueChecker extends FocusAdapter implements ActionListener { 248 private JTextField tfLonValue;249 private MyTextField tfLonValue; 249 250 250 public LonValueChecker( JTextField tfLonValue) {251 public LonValueChecker(MyTextField tfLonValue) { 251 252 this.tfLonValue = tfLonValue; 252 253 } 253 254 -
src/org/openstreetmap/josm/gui/MainApplet.java
22 22 import javax.swing.JOptionPane; 23 23 import javax.swing.JPanel; 24 24 import javax.swing.JPasswordField; 25 import javax.swing.JTextField;25 //import javax.swing.JTextField; 26 26 27 27 import org.openstreetmap.josm.Main; 28 28 import org.openstreetmap.josm.actions.JosmAction; … … 32 32 import org.openstreetmap.josm.tools.GBC; 33 33 import org.openstreetmap.josm.tools.I18n; 34 34 import org.openstreetmap.josm.tools.Shortcut; 35 import org.openstreetmap.josm.gui.MyTextField; 35 36 36 37 public class MainApplet extends JApplet { 37 38 … … 112 113 JPanel p = new JPanel(new GridBagLayout()); 113 114 p.add(new JLabel(tr(e.realm)), GBC.eol().fill(GBC.HORIZONTAL)); 114 115 p.add(new JLabel(tr("Username")), GBC.std().insets(0,0,20,0)); 115 JTextField user = new JTextField(username == null ? "" : username);116 MyTextField user = new MyTextField(username == null ? "" : username); 116 117 p.add(user, GBC.eol().fill(GBC.HORIZONTAL)); 117 118 p.add(new JLabel(tr("Password")), GBC.std().insets(0,0,20,0)); 118 119 JPasswordField pass = new JosmPasswordField(password == null ? "" : password); -
src/org/openstreetmap/josm/gui/MyTextField.java
1 package org.openstreetmap.josm.gui; 2 3 import java.awt.*; 4 import java.awt.event.*; 5 6 import javax.swing.*; 7 import javax.swing.event.*; 8 import javax.swing.text.*; 9 import javax.swing.undo.*; 10 11 public class MyTextField extends JTextField { 12 private JPopupMenu contextMenu; 13 private UndoManager undoManager; 14 15 public MyTextField(Document doc, String text, int columns){ 16 super(doc, text, columns); 17 init(); 18 } 19 20 public MyTextField(String text, int columns){ 21 super(text, columns); 22 init(); 23 } 24 25 public MyTextField(String text){ 26 super(text); 27 init(); 28 } 29 30 public MyTextField(int columns){ 31 super(columns); 32 init(); 33 } 34 35 public MyTextField() { 36 super(); 37 init(); 38 } 39 40 private void init(){ 41 undoManager = new UndoManager(); 42 contextMenu = new JPopupMenu(); 43 UndoAction undoAction = new UndoAction(); 44 addToContextMenu("Paste", DefaultEditorKit.pasteAction); 45 contextMenu.addSeparator(); 46 contextMenu.add(new JMenuItem(undoAction)); 47 getDocument().addUndoableEditListener(undoAction); 48 contextMenu.addSeparator(); 49 addToContextMenu("Cut", DefaultEditorKit.cutAction); 50 addToContextMenu("Copy", DefaultEditorKit.copyAction); 51 addToContextMenu("Delete", DefaultEditorKit.deleteNextCharAction); 52 contextMenu.addSeparator(); 53 addToContextMenu("Select All", DefaultEditorKit.selectAllAction); 54 55 addMouseListener(new MouseAdapter() { 56 public void mousePressed(MouseEvent e) { 57 if (e.getButton() == MouseEvent.BUTTON3) { 58 contextMenu.show(MyTextField.this, e.getX(), e.getY()); 59 } 60 } 61 }); 62 } 63 64 private void addToContextMenu(String label, String actionName) { 65 Action action = getActionMap().get(actionName); 66 if (action != null) { 67 JMenuItem mi = new JMenuItem(action); 68 mi.setText(label); 69 contextMenu.add(mi); 70 } 71 } 72 73 74 class UndoAction extends AbstractAction implements UndoableEditListener { 75 public UndoAction() { 76 super("Undo"); 77 setEnabled(false); 78 } 79 80 public void undoableEditHappened(UndoableEditEvent e) { 81 undoManager.addEdit(e.getEdit()); 82 setEnabled(undoManager.canUndo()); 83 } 84 85 public void actionPerformed(ActionEvent e) { 86 try { 87 undoManager.undo(); 88 } catch (CannotUndoException ex) { 89 } 90 setEnabled(undoManager.canUndo()); 91 } 92 } 93 94 /* 95 public static void main(String[] args) { 96 JFrame frame = new JFrame(); 97 JTextField tf = new MyTextField(); 98 frame.getContentPane().add(tf); 99 frame.pack(); 100 frame.setLocation(200, 200); 101 frame.setVisible(true); 102 } 103 */ 104 } -
src/org/openstreetmap/josm/gui/tagging/TaggingPresetSearchDialog.java
30 30 import javax.swing.JList; 31 31 import javax.swing.JPanel; 32 32 import javax.swing.JScrollPane; 33 import javax.swing.JTextField;33 //import javax.swing.JTextField; 34 34 import javax.swing.event.DocumentEvent; 35 35 import javax.swing.event.DocumentListener; 36 36 … … 49 49 import org.openstreetmap.josm.gui.tagging.TaggingPreset.PresetType; 50 50 import org.openstreetmap.josm.gui.tagging.TaggingPreset.Role; 51 51 import org.openstreetmap.josm.gui.tagging.TaggingPreset.Roles; 52 import org.openstreetmap.josm.gui.MyTextField; 52 53 54 53 55 public class TaggingPresetSearchDialog extends ExtendedDialog implements SelectionChangedListener { 54 56 55 57 private static final int CLASSIFICATION_IN_FAVORITES = 300; … … 191 193 return instance; 192 194 } 193 195 194 private JTextField edSearchText;196 private MyTextField edSearchText; 195 197 private JList lsResult; 196 198 private JCheckBox ckOnlyApplicable; 197 199 private JCheckBox ckSearchInTags; … … 238 240 JPanel content = new JPanel(); 239 241 content.setLayout(new BorderLayout()); 240 242 241 edSearchText = new JTextField();243 edSearchText = new MyTextField(); 242 244 edSearchText.getDocument().addDocumentListener(new DocumentListener() { 243 245 244 246 @Override -
src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingTextField.java
10 10 11 11 import javax.swing.ComboBoxEditor; 12 12 import javax.swing.JTable; 13 import javax.swing.JTextField;13 //import javax.swing.JTextField; 14 14 import javax.swing.event.CellEditorListener; 15 15 import javax.swing.table.TableCellEditor; 16 16 import javax.swing.text.AttributeSet; … … 21 21 22 22 import org.openstreetmap.josm.Main; 23 23 import org.openstreetmap.josm.gui.util.TableCellEditorSupport; 24 import org.openstreetmap.josm.gui.MyTextField; 24 25 26 25 27 /** 26 28 * AutoCompletingTextField is an text field with autocompletion behaviour. It 27 29 * can be used as table cell editor in {@link JTable}s. … … 31 33 * 32 34 * 33 35 */ 34 public class AutoCompletingTextField extends JTextField implements ComboBoxEditor, TableCellEditor {36 public class AutoCompletingTextField extends MyTextField implements ComboBoxEditor, TableCellEditor { 35 37 36 38 private Integer maxChars; 37 39 -
src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
45 45 import javax.swing.JOptionPane; 46 46 import javax.swing.JPanel; 47 47 import javax.swing.JScrollPane; 48 import javax.swing.JTextField;48 //import javax.swing.JTextField; 49 49 import javax.swing.JToggleButton; 50 50 import javax.swing.ListCellRenderer; 51 51 import javax.swing.ListModel; … … 91 91 import org.openstreetmap.josm.tools.template_engine.TemplateEntry; 92 92 import org.openstreetmap.josm.tools.template_engine.TemplateParser; 93 93 import org.xml.sax.SAXException; 94 import org.openstreetmap.josm.gui.MyTextField; 94 95 96 95 97 /** 96 98 * This class read encapsulate one tagging preset. A class method can 97 99 * read in all predefined presets, either shipped with JOSM or that are … … 521 523 private static String getValue(Component comp) { 522 524 if (comp instanceof JosmComboBox) { 523 525 return ((JosmComboBox) comp).getEditor().getItem().toString(); 524 } else if (comp instanceof JTextField) {525 return (( JTextField) comp).getText();526 } else if (comp instanceof MyTextField) { 527 return ((MyTextField) comp).getText(); 526 528 } else if (comp instanceof JPanel) { 527 529 return getValue(((JPanel)comp).getComponent(0)); 528 530 } else { -
src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
25 25 import javax.swing.JPanel; 26 26 import javax.swing.JSeparator; 27 27 import javax.swing.JTabbedPane; 28 import javax.swing.JTextField;28 //import javax.swing.JTextField; 29 29 import javax.swing.UIManager; 30 30 import javax.swing.event.ChangeEvent; 31 31 import javax.swing.event.ChangeListener; 32 32 import javax.swing.event.DocumentEvent; 33 33 import javax.swing.event.DocumentListener; 34 34 35 import org.openstreetmap.josm.gui.MyTextField; 36 35 37 import org.openstreetmap.josm.Main; 36 38 import org.openstreetmap.josm.data.coor.CoordinateFormat; 37 39 import org.openstreetmap.josm.data.coor.EastNorth; … … 46 48 private static final Color BG_COLOR_ERROR = new Color(255,224,224); 47 49 48 50 public JTabbedPane tabs; 49 private JTextField tfLatLon, tfEastNorth;51 private MyTextField tfLatLon, tfEastNorth; 50 52 private LatLon latLonCoordinates; 51 53 private EastNorth eastNorthCoordinates; 52 54 … … 76 78 pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 77 79 78 80 pnl.add(new JLabel(tr("Coordinates:")), GBC.std().insets(0,10,5,0)); 79 tfLatLon = new JTextField(24);81 tfLatLon = new MyTextField(24); 80 82 pnl.add(tfLatLon, GBC.eol().insets(0,10,0,0).fill(GBC.HORIZONTAL).weight(1.0, 0.0)); 81 83 82 84 pnl.add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL).insets(0,5,0,5)); … … 128 130 pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 129 131 130 132 pnl.add(new JLabel(tr("Projected coordinates:")), GBC.std().insets(0,10,5,0)); 131 tfEastNorth = new JTextField(24);133 tfEastNorth = new MyTextField(24); 132 134 133 135 pnl.add(tfEastNorth, GBC.eol().insets(0,10,0,0).fill(GBC.HORIZONTAL).weight(1.0, 0.0)); 134 136 … … 207 209 return eastNorthCoordinates; 208 210 } 209 211 210 protected void setErrorFeedback( JTextField tf, String message) {212 protected void setErrorFeedback(MyTextField tf, String message) { 211 213 tf.setBorder(BorderFactory.createLineBorder(Color.RED, 1)); 212 214 tf.setToolTipText(message); 213 215 tf.setBackground(BG_COLOR_ERROR); 214 216 } 215 217 216 protected void clearErrorFeedback( JTextField tf, String message) {218 protected void clearErrorFeedback(MyTextField tf, String message) { 217 219 tf.setBorder(UIManager.getBorder("TextField.border")); 218 220 tf.setToolTipText(message); 219 221 tf.setBackground(UIManager.getColor("TextField.background")); … … 328 330 static class TextFieldFocusHandler implements FocusListener { 329 331 public void focusGained(FocusEvent e) { 330 332 Component c = e.getComponent(); 331 if (c instanceof JTextField) {332 JTextField tf = (JTextField)c;333 if (c instanceof MyTextField) { 334 MyTextField tf = (MyTextField)c; 333 335 tf.selectAll(); 334 336 } 335 337 } -
src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java
15 15 import javax.swing.BorderFactory; 16 16 import javax.swing.JLabel; 17 17 import javax.swing.JPanel; 18 import javax.swing.JTextField;18 //import javax.swing.JTextField; 19 19 import javax.swing.event.DocumentEvent; 20 20 import javax.swing.event.DocumentListener; 21 21 import javax.swing.event.HyperlinkEvent; … … 26 26 import org.openstreetmap.josm.io.OsmApi; 27 27 import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlException; 28 28 import org.openstreetmap.josm.tools.ImageProvider; 29 import org.openstreetmap.josm.gui.MyTextField; 29 30 30 31 31 32 public class UrlBasedQueryPanel extends JPanel { 32 33 33 private JTextField tfUrl;34 private MyTextField tfUrl; 34 35 private JLabel lblValid; 35 36 36 37 protected JPanel buildURLPanel() { … … 44 45 gc.gridx = 1; 45 46 gc.weightx = 1.0; 46 47 gc.fill = GridBagConstraints.HORIZONTAL; 47 pnl.add(tfUrl = new JTextField(), gc);48 pnl.add(tfUrl = new MyTextField(), gc); 48 49 tfUrl.getDocument().addDocumentListener(new ChangetQueryUrlValidator()); 49 50 tfUrl.addFocusListener( 50 51 new FocusAdapter() { -
src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java
24 24 import javax.swing.JPanel; 25 25 import javax.swing.JRadioButton; 26 26 import javax.swing.JScrollPane; 27 import javax.swing.JTextField;27 //import javax.swing.JTextField; 28 28 import javax.swing.text.JTextComponent; 29 29 30 30 import org.openstreetmap.josm.Main; … … 38 38 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 39 39 import org.openstreetmap.josm.io.ChangesetQuery; 40 40 import org.openstreetmap.josm.tools.CheckParameterUtil; 41 import org.openstreetmap.josm.gui.MyTextField; 41 42 43 42 44 /** 43 45 * This panel allows to specify a changeset query 44 46 * … … 374 376 private JRadioButton rbRestrictToMyself; 375 377 private JRadioButton rbRestrictToUid; 376 378 private JRadioButton rbRestrictToUserName; 377 private JTextField tfUid;379 private MyTextField tfUid; 378 380 private UidInputFieldValidator valUid; 379 private JTextField tfUserName;381 private MyTextField tfUserName; 380 382 private UserNameInputValidator valUserName; 381 383 private JMultilineLabel lblRestrictedToMyself; 382 384 … … 389 391 pnl.add(new JLabel(tr("User ID:")), gc); 390 392 391 393 gc.gridx = 1; 392 pnl.add(tfUid = new JTextField(10),gc);394 pnl.add(tfUid = new MyTextField(10),gc); 393 395 SelectAllOnFocusGainedDecorator.decorate(tfUid); 394 396 valUid = UidInputFieldValidator.decorate(tfUid); 395 397 … … 409 411 pnl.add(new JLabel(tr("User name:")), gc); 410 412 411 413 gc.gridx = 1; 412 pnl.add(tfUserName = new JTextField(10),gc);414 pnl.add(tfUserName = new MyTextField(10),gc); 413 415 SelectAllOnFocusGainedDecorator.decorate(tfUserName); 414 416 valUserName = UserNameInputValidator.decorate(tfUserName); 415 417 … … 634 636 635 637 private JRadioButton rbClosedAfter; 636 638 private JRadioButton rbClosedAfterAndCreatedBefore; 637 private JTextField tfClosedAfterDate1;639 private MyTextField tfClosedAfterDate1; 638 640 private DateValidator valClosedAfterDate1; 639 private JTextField tfClosedAfterTime1;641 private MyTextField tfClosedAfterTime1; 640 642 private TimeValidator valClosedAfterTime1; 641 private JTextField tfClosedAfterDate2;643 private MyTextField tfClosedAfterDate2; 642 644 private DateValidator valClosedAfterDate2; 643 private JTextField tfClosedAfterTime2;645 private MyTextField tfClosedAfterTime2; 644 646 private TimeValidator valClosedAfterTime2; 645 private JTextField tfCreatedBeforeDate;647 private MyTextField tfCreatedBeforeDate; 646 648 private DateValidator valCreatedBeforeDate; 647 private JTextField tfCreatedBeforeTime;649 private MyTextField tfCreatedBeforeTime; 648 650 private TimeValidator valCreatedBeforeTime; 649 651 650 652 protected JPanel buildClosedAfterInputPanel() { … … 657 659 658 660 gc.gridx = 1; 659 661 gc.weightx = 0.7; 660 pnl.add(tfClosedAfterDate1 = new JTextField(),gc);662 pnl.add(tfClosedAfterDate1 = new MyTextField(),gc); 661 663 SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterDate1); 662 664 valClosedAfterDate1 = DateValidator.decorate(tfClosedAfterDate1); 663 665 tfClosedAfterDate1.setToolTipText(valClosedAfterDate1.getStandardTooltipTextAsHtml()); … … 668 670 669 671 gc.gridx = 3; 670 672 gc.weightx = 0.3; 671 pnl.add(tfClosedAfterTime1 = new JTextField(),gc);673 pnl.add(tfClosedAfterTime1 = new MyTextField(),gc); 672 674 SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterTime1); 673 675 valClosedAfterTime1 = TimeValidator.decorate(tfClosedAfterTime1); 674 676 tfClosedAfterTime1.setToolTipText(valClosedAfterTime1.getStandardTooltipTextAsHtml()); … … 691 693 692 694 gc.gridx = 2; 693 695 gc.weightx = 0.7; 694 pnl.add(tfClosedAfterDate2 = new JTextField(),gc);696 pnl.add(tfClosedAfterDate2 = new MyTextField(),gc); 695 697 SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterDate2); 696 698 valClosedAfterDate2 = DateValidator.decorate(tfClosedAfterDate2); 697 699 tfClosedAfterDate2.setToolTipText(valClosedAfterDate2.getStandardTooltipTextAsHtml()); … … 701 703 702 704 gc.gridx = 4; 703 705 gc.weightx = 0.3; 704 pnl.add(tfClosedAfterTime2 = new JTextField(),gc);706 pnl.add(tfClosedAfterTime2 = new MyTextField(),gc); 705 707 SelectAllOnFocusGainedDecorator.decorate(tfClosedAfterTime2); 706 708 valClosedAfterTime2 = TimeValidator.decorate(tfClosedAfterTime2); 707 709 tfClosedAfterTime2.setToolTipText(valClosedAfterTime2.getStandardTooltipTextAsHtml()); … … 721 723 722 724 gc.gridx = 2; 723 725 gc.weightx = 0.7; 724 pnl.add(tfCreatedBeforeDate = new JTextField(),gc);726 pnl.add(tfCreatedBeforeDate = new MyTextField(),gc); 725 727 SelectAllOnFocusGainedDecorator.decorate(tfCreatedBeforeDate); 726 728 valCreatedBeforeDate = DateValidator.decorate(tfCreatedBeforeDate); 727 729 tfCreatedBeforeDate.setToolTipText(valCreatedBeforeDate.getStandardTooltipTextAsHtml()); … … 732 734 733 735 gc.gridx = 4; 734 736 gc.weightx = 0.3; 735 pnl.add(tfCreatedBeforeTime = new JTextField(),gc);737 pnl.add(tfCreatedBeforeTime = new MyTextField(),gc); 736 738 SelectAllOnFocusGainedDecorator.decorate(tfCreatedBeforeTime); 737 739 valCreatedBeforeTime = TimeValidator.decorate(tfCreatedBeforeTime); 738 740 tfCreatedBeforeTime.setToolTipText(valCreatedBeforeDate.getStandardTooltipTextAsHtml()); -
src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java
26 26 import javax.swing.JOptionPane; 27 27 import javax.swing.JPanel; 28 28 import javax.swing.JTextArea; 29 import javax.swing.JTextField;29 //import javax.swing.JTextField; 30 30 import javax.swing.JToolBar; 31 31 32 32 import org.openstreetmap.josm.Main; … … 40 40 import org.openstreetmap.josm.gui.help.HelpUtil; 41 41 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 42 42 import org.openstreetmap.josm.tools.ImageProvider; 43 import org.openstreetmap.josm.gui.MyTextField; 43 44 45 44 46 /** 45 47 * This panel displays the properties of the currently selected changeset in the 46 48 * {@link ChangesetCacheManager}. … … 48 50 */ 49 51 public class ChangesetDetailPanel extends JPanel implements PropertyChangeListener{ 50 52 51 private JTextField tfID;53 private MyTextField tfID; 52 54 private JTextArea taComment; 53 private JTextField tfOpen;54 private JTextField tfUser;55 private JTextField tfCreatedOn;56 private JTextField tfClosedOn;55 private MyTextField tfOpen; 56 private MyTextField tfUser; 57 private MyTextField tfCreatedOn; 58 private MyTextField tfClosedOn; 57 59 private DonwloadChangesetContentAction actDownloadChangesetContent; 58 60 private UpdateChangesetAction actUpdateChangesets; 59 61 private RemoveFromCacheAction actRemoveFromCache; … … 117 119 gc.fill = GridBagConstraints.HORIZONTAL; 118 120 gc.weightx = 0.0; 119 121 gc.gridx = 1; 120 pnl.add(tfID = new JTextField(10), gc);122 pnl.add(tfID = new MyTextField(10), gc); 121 123 tfID.setEditable(false); 122 124 123 125 //-- comment … … 144 146 145 147 gc.fill = GridBagConstraints.HORIZONTAL; 146 148 gc.gridx = 1; 147 pnl.add(tfOpen= new JTextField(10), gc);149 pnl.add(tfOpen= new MyTextField(10), gc); 148 150 tfOpen.setEditable(false); 149 151 150 152 //-- Created by: … … 157 159 gc.fill = GridBagConstraints.HORIZONTAL; 158 160 gc.weightx = 1.0; 159 161 gc.gridx = 1; 160 pnl.add(tfUser= new JTextField(""), gc);162 pnl.add(tfUser= new MyTextField(""), gc); 161 163 tfUser.setEditable(false); 162 164 163 165 //-- Created On: … … 169 171 170 172 gc.fill = GridBagConstraints.HORIZONTAL; 171 173 gc.gridx = 1; 172 pnl.add(tfCreatedOn= new JTextField(20), gc);174 pnl.add(tfCreatedOn= new MyTextField(20), gc); 173 175 tfCreatedOn.setEditable(false); 174 176 175 177 //-- Closed On: … … 181 183 182 184 gc.fill = GridBagConstraints.HORIZONTAL; 183 185 gc.gridx = 1; 184 pnl.add(tfClosedOn= new JTextField(20), gc);186 pnl.add(tfClosedOn= new MyTextField(20), gc); 185 187 tfClosedOn.setEditable(false); 186 188 187 189 return pnl; -
src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
34 34 import javax.swing.JPopupMenu; 35 35 import javax.swing.JSlider; 36 36 import javax.swing.JTable; 37 import javax.swing.JTextField;37 //import javax.swing.JTextField; 38 38 import javax.swing.JViewport; 39 39 import javax.swing.KeyStroke; 40 40 import javax.swing.ListSelectionModel; … … 71 71 import org.openstreetmap.josm.tools.MultikeyShortcutAction; 72 72 import org.openstreetmap.josm.tools.MultikeyShortcutAction.MultikeyInfo; 73 73 import org.openstreetmap.josm.tools.Shortcut; 74 import org.openstreetmap.josm.gui.MyTextField; 74 75 75 76 /** 76 77 * This is a toggle dialog which displays the list of layers. Actions allow to … … 193 194 layerList.getColumnModel().getColumn(1).setPreferredWidth(16); 194 195 layerList.getColumnModel().getColumn(1).setResizable(false); 195 196 layerList.getColumnModel().getColumn(2).setCellRenderer(new LayerNameCellRenderer()); 196 layerList.getColumnModel().getColumn(2).setCellEditor(new LayerNameCellEditor(new JTextField()));197 layerList.getColumnModel().getColumn(2).setCellEditor(new LayerNameCellEditor(new MyTextField())); 197 198 for (KeyStroke ks : new KeyStroke[] { 198 199 KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK), 199 200 KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK), … … 1008 1009 } 1009 1010 1010 1011 private static class LayerNameCellEditor extends DefaultCellEditor { 1011 public LayerNameCellEditor( JTextField tf) {1012 public LayerNameCellEditor(MyTextField tf) { 1012 1013 super(tf); 1013 1014 } 1014 1015 1015 1016 @Override 1016 1017 public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { 1017 JTextField tf = (JTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column);1018 MyTextField tf = (MyTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column); 1018 1019 tf.setText(value == null ? "" : ((Layer) value).getName()); 1019 1020 return tf; 1020 1021 } -
src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
26 26 import javax.swing.JPanel; 27 27 import javax.swing.JPopupMenu; 28 28 import javax.swing.JScrollPane; 29 import javax.swing.JTextField;29 //import javax.swing.JTextField; 30 30 import javax.swing.KeyStroke; 31 31 import javax.swing.ListSelectionModel; 32 32 import javax.swing.SwingUtilities; … … 75 75 import org.openstreetmap.josm.tools.Predicate; 76 76 import org.openstreetmap.josm.tools.Shortcut; 77 77 import org.openstreetmap.josm.tools.Utils; 78 import org.openstreetmap.josm.gui.MyTextField; 78 79 79 80 /** 80 81 * A dialog showing all known relations, with buttons to add, edit, and … … 95 96 private final JPopupMenu popupMenu = new JPopupMenu(); 96 97 private final PopupMenuHandler popupMenuHandler = new PopupMenuHandler(popupMenu); 97 98 98 private final JTextField filter;99 private final MyTextField filter; 99 100 100 101 // Actions 101 102 /** the edit action */ … … 259 260 } 260 261 } 261 262 262 private JTextField setupFilter() {263 final JTextField f = new DisableShortcutsOnFocusGainedTextField();263 private MyTextField setupFilter() { 264 final MyTextField f = new DisableShortcutsOnFocusGainedTextField(); 264 265 f.setToolTipText(tr("Relation list filter")); 265 266 f.getDocument().addDocumentListener(new DocumentListener() { 266 267 -
src/org/openstreetmap/josm/actions/RenameLayerAction.java
13 13 import javax.swing.JCheckBox; 14 14 import javax.swing.JDialog; 15 15 import javax.swing.JOptionPane; 16 import javax.swing.JTextField;16 //import javax.swing.JTextField; 17 17 18 18 import org.openstreetmap.josm.Main; 19 19 import org.openstreetmap.josm.gui.layer.Layer; 20 20 import org.openstreetmap.josm.tools.ImageProvider; 21 import org.openstreetmap.josm.gui.MyTextField; 21 22 22 23 /** 23 24 * Action to rename an specific layer. Provides the option to rename the … … 43 44 44 45 public void actionPerformed(ActionEvent e) { 45 46 Box panel = Box.createVerticalBox(); 46 final JTextField name = new JTextField(layer.getName());47 final MyTextField name = new MyTextField(layer.getName()); 47 48 panel.add(name); 48 49 JCheckBox filerename = new JCheckBox(tr("Also rename the file")); 49 50 if (Main.applet) { -
src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
19 19 20 20 import javax.swing.JLabel; 21 21 import javax.swing.JPanel; 22 import javax.swing.JTextField;22 //import javax.swing.JTextField; 23 23 24 24 import org.openstreetmap.josm.Main; 25 25 import org.openstreetmap.josm.actions.mapmode.MapMode; … … 30 30 import org.openstreetmap.josm.gui.layer.ImageryLayer; 31 31 import org.openstreetmap.josm.tools.GBC; 32 32 import org.openstreetmap.josm.tools.ImageProvider; 33 import org.openstreetmap.josm.gui.MyTextField; 33 34 34 35 35 36 public class ImageryAdjustAction extends MapMode implements MouseListener, MouseMotionListener, AWTEventListener{ … … 148 149 } 149 150 150 151 class ImageryOffsetDialog extends ExtendedDialog implements FocusListener { 151 public final JTextField tOffset = new JTextField();152 JTextField tBookmarkName = new JTextField();152 public final MyTextField tOffset = new MyTextField(); 153 MyTextField tBookmarkName = new MyTextField(); 153 154 private boolean ignoreListener; 154 155 public ImageryOffsetDialog() { 155 156 super(Main.parent, -
src/org/openstreetmap/josm/actions/Map_Rectifier_WMSmenuAction.java
16 16 import javax.swing.JOptionPane; 17 17 import javax.swing.JPanel; 18 18 import javax.swing.JRadioButton; 19 import javax.swing.JTextField;19 //import javax.swing.JTextField; 20 20 21 21 import org.openstreetmap.josm.Main; 22 22 import org.openstreetmap.josm.data.imagery.ImageryInfo; … … 26 26 import org.openstreetmap.josm.tools.Shortcut; 27 27 import org.openstreetmap.josm.tools.UrlLabel; 28 28 import org.openstreetmap.josm.tools.Utils; 29 import org.openstreetmap.josm.gui.MyTextField; 29 30 30 31 public class Map_Rectifier_WMSmenuAction extends JosmAction { 31 32 /** … … 110 111 JPanel panel = new JPanel(new GridBagLayout()); 111 112 panel.add(new JLabel(tr("Supported Rectifier Services:")), GBC.eol()); 112 113 113 JTextField tfWmsUrl = new JTextField(30);114 MyTextField tfWmsUrl = new MyTextField(30); 114 115 115 116 String clip = Utils.getClipboardContent(); 116 117 clip = clip == null ? "" : clip.trim(); -
src/org/openstreetmap/josm/actions/search/SearchAction.java
29 29 import javax.swing.JOptionPane; 30 30 import javax.swing.JPanel; 31 31 import javax.swing.JRadioButton; 32 import javax.swing.JTextField;32 //import javax.swing.JTextField; 33 33 import javax.swing.text.BadLocationException; 34 34 35 35 import org.openstreetmap.josm.Main; … … 50 50 import org.openstreetmap.josm.tools.Property; 51 51 import org.openstreetmap.josm.tools.Shortcut; 52 52 import org.openstreetmap.josm.tools.Utils; 53 import org.openstreetmap.josm.gui.MyTextField; 53 54 55 54 56 public class SearchAction extends JosmAction implements ParameterizedAction { 55 57 56 58 public static final int DEFAULT_SEARCH_HISTORY_SIZE = 15; … … 194 196 @Override 195 197 public void mouseClicked(MouseEvent e) { 196 198 try { 197 JTextField tf = (JTextField) hcb.getEditor().getEditorComponent();199 MyTextField tf = (MyTextField) hcb.getEditor().getEditorComponent(); 198 200 tf.getDocument().insertString(tf.getCaretPosition(), " " + insertText, null); 199 201 } catch (BadLocationException ex) { 200 202 throw new RuntimeException(ex.getMessage(), ex); -
src/org/openstreetmap/josm/actions/JumpToAction.java
13 13 import javax.swing.JLabel; 14 14 import javax.swing.JOptionPane; 15 15 import javax.swing.JPanel; 16 import javax.swing.JTextField;16 //import javax.swing.JTextField; 17 17 import javax.swing.event.DocumentEvent; 18 18 import javax.swing.event.DocumentListener; 19 19 … … 24 24 import org.openstreetmap.josm.tools.GBC; 25 25 import org.openstreetmap.josm.tools.OsmUrlToBounds; 26 26 import org.openstreetmap.josm.tools.Shortcut; 27 import org.openstreetmap.josm.gui.MyTextField; 27 28 28 29 public class JumpToAction extends JosmAction implements MouseListener { 29 30 public JumpToAction() { … … 33 34 Main.toolbar.register(this); 34 35 } 35 36 36 private JTextField url = new JTextField();37 private JTextField lat = new JTextField();38 private JTextField lon = new JTextField();39 private JTextField zm = new JTextField();37 private MyTextField url = new MyTextField(); 38 private MyTextField lat = new MyTextField(); 39 private MyTextField lon = new MyTextField(); 40 private MyTextField zm = new MyTextField(); 40 41 41 42 private double zoomFactor = 0; 42 43 public void showJumpToDialog() {