Changeset 736 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-07-25T08:11:13+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r735 r736 54 54 URL elemStylesPath = Main.class.getResource("/styles/"+styleName+"/elemstyles.xml"); 55 55 56 System.out.println("mappaint: Using jar's elemstyles.xml: \"" + elemStylesPath + "\"");56 // System.out.println("mappaint: Using jar's elemstyles.xml: \"" + elemStylesPath + "\""); 57 57 if (elemStylesPath != null) 58 58 { -
trunk/src/org/openstreetmap/josm/tools/AutoCompleteComboBox.java
r627 r736 19 19 /** 20 20 * Auto-complete a JComboBox. 21 * 21 * 22 22 * Inspired by http://www.orbital-computer.de/JComboBox/ 23 23 */ … … 37 37 38 38 @Override public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { 39 if(selecting || (offs == 0 && str.equals(getText(0, getLength())))) 40 return; 39 41 super.insertString(offs, str, a); 40 42 41 43 // return immediately when selecting an item 42 // Not a: this is done after calling super method because we need44 // Note: this is done after calling super method because we need 43 45 // ActionListener informed 44 46 if (selecting) 45 47 return; 46 48 49 int size = getLength(); 50 String curText = getText(0, size); 47 51 // lookup and select a matching item 48 Object item = lookupItem( getText(0, getLength()));52 Object item = lookupItem(curText); 49 53 if (item != null) { 50 // remove all text and insert the completed string 51 super.remove(0, getLength()); 52 super.insertString(0, item.toString(), a); 53 54 String newText = item.toString(); 55 if(!newText.equals(curText)) 56 { 57 selecting = true; 58 super.remove(0, size); 59 super.insertString(0, newText, a); 60 selecting = false; 61 JTextComponent editor = (JTextComponent)comboBox.getEditor().getEditorComponent(); 62 editor.setSelectionStart(size); 63 editor.setSelectionEnd(getLength()); 64 } 54 65 } 55 56 66 setSelectedItem(item); 57 58 // select the completed part59 JTextComponent editor = (JTextComponent)comboBox.getEditor().getEditorComponent();60 editor.setSelectionStart(offs + str.length());61 editor.setSelectionEnd(getLength());62 67 } 63 68
Note:
See TracChangeset
for help on using the changeset viewer.