org.jurvis.swing
Class JvReadOnlyPlainDocument
java.lang.Object
javax.swing.text.AbstractDocument
javax.swing.text.PlainDocument
org.jurvis.swing.JvReadOnlyPlainDocument
- All Implemented Interfaces:
- Serializable, Document
public class JvReadOnlyPlainDocument
- extends PlainDocument
A PlainDocument that does not allow the user to make edits.
Frequently, when using a JTextField to display always
non-editable text, using this document is preferable to making the
JTextComponent non-editable.
- Author:
- Neil W. Weber
- See Also:
JvReadOnlyTextField,
Serialized Form
|
Method Summary |
void |
insertString(int offs,
String str,
AttributeSet a)
Inserts some content into the document. |
void |
remove(int offs,
int len)
Removes a portion of the content of the document. |
| Methods inherited from class javax.swing.text.AbstractDocument |
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMPTY_DOCUMENT
public static final JvReadOnlyPlainDocument EMPTY_DOCUMENT
JvReadOnlyPlainDocument
public JvReadOnlyPlainDocument()
- Constructs a plain, empty text document.
JvReadOnlyPlainDocument
public JvReadOnlyPlainDocument(String s)
- Constructs a plain text document with the given string.
- Parameters:
s - the string to represent
insertString
public void insertString(int offs,
String str,
AttributeSet a)
throws BadLocationException
- Inserts some content into the document. Actually, in this class this
method simply discards the new content and does nothing.
- Specified by:
insertString in interface Document- Overrides:
insertString in class PlainDocument
- Parameters:
offs - the starting offset >= 0str - the string to insert; does nothing with null/empty stringsa - the attributes for the inserted content
- Throws:
BadLocationException - the given insert position is not a valid
position within the document- See Also:
Document.insertString(int, java.lang.String, javax.swing.text.AttributeSet)
remove
public void remove(int offs,
int len)
throws BadLocationException
- Removes a portion of the content of the document. Actually, in this class
this method just ignores the removal and does nothing.
- Specified by:
remove in interface Document- Overrides:
remove in class AbstractDocument
- Parameters:
offs - the offset from the beginning >= 0len - the number of characters to remove >= 0
- Throws:
BadLocationException - some portion of the removal range
was not a valid part of the document. The location in the exception
is the first bad position encountered.
Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.