Java examples for Swing:Swing HTML
Mark that the ongoing Swing document modification(s) will be caused by user's typing.
//package com.java2s; import javax.swing.text.Document; public class Main { private static final Object TYPING_MODIFICATION_DOCUMENT_PROPERTY = new Object(); /**/*from w w w . j a v a 2 s . co m*/ * Mark that the ongoing document modification(s) will be caused * by user's typing. * It should be used by default-key-typed-action and the actions * for backspace and delete keys. * <br/> * The document listeners being fired may * query it by using {@link #isTypingModification(Document)}. * This method should always be used in the following pattern: * <pre> * DocumentUtilities.setTypingModification(doc, true); * try { * doc.insertString(offset, typedText, null); * } finally { * DocumentUtilities.setTypingModification(doc, false); * } * </pre> * * @see #isTypingModification(Document) */ public static void setTypingModification(Document doc, boolean typingModification) { doc.putProperty(TYPING_MODIFICATION_DOCUMENT_PROPERTY, Boolean.valueOf(typingModification)); } }