void (InputMethodEvent e) { int commitCount = e.getCommittedCharacterCount(); AttributedCharacterIterator text = e.getText(); int composedTextIndex; // old composed text deletion final Document doc = getDocument(); if (composedText != null) { if (!isViewer() && doc.isWritable()) { runUndoTransparent(new Runnable() { public void run() { doc.deleteString(Math.max(0, composedTextStart), Math.min(composedTextEnd, doc.getTextLength())); } }); } composedText = null; } if (text != null) { text.first(); // committed text insertion if (commitCount > 0) { for (char c = text.current(); commitCount > 0; c = text.next(), commitCount--) { if (c >= 0x20 && c != 0x7F) { // Hack just like in javax.swing.text.DefaultEditorKit.DefaultKeyTypedAction processKeyTyped(c); } } } // new composed text insertion if (!isViewer() && doc.isWritable()) { composedTextIndex = text.getIndex(); if (composedTextIndex < text.getEndIndex()) { createComposedString(composedTextIndex, text); runUndoTransparent(new Runnable() { public void run() { EditorModificationUtil.insertStringAtCaret(EditorImpl.this, composedText, false, false); } }); composedTextStart = getCaretModel().getOffset(); composedTextEnd = getCaretModel().getOffset() + composedText.length(); } } } }