Changeset 4576 in josm
- Timestamp:
- 2011-11-05T16:56:37+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java
r4508 r4576 14 14 import javax.swing.JList; 15 15 import javax.swing.ListCellRenderer; 16 import javax.swing.text.AbstractDocument;17 16 import javax.swing.text.AttributeSet; 18 17 import javax.swing.text.BadLocationException; … … 22 21 23 22 import org.openstreetmap.josm.Main; 24 import org.openstreetmap.josm.gui.DocumentSizeFilter;25 23 26 24 /** … … 30 28 31 29 private boolean autocompleteEnabled = true; 30 31 private int maxTextLength = -1; 32 32 33 33 /** … … 53 53 if (selecting || (offs == 0 && str.equals(getText(0, getLength())))) 54 54 return; 55 if (maxTextLength > -1 && str.length()+getLength() > maxTextLength) { 56 return; 57 } 55 58 boolean initial = (offs == 0 && getLength() == 0 && str.length() > 1); 56 59 super.insertString(offs, str, a); … … 154 157 public void setMaxTextLength(int length) 155 158 { 156 JTextComponent editor = (JTextComponent) this.getEditor().getEditorComponent(); 157 AbstractDocument doc = (AbstractDocument) editor.getDocument(); 158 doc.setDocumentFilter(new DocumentSizeFilter(length)); 159 this.maxTextLength = length; 159 160 } 160 161
Note:
See TracChangeset
for help on using the changeset viewer.