javax.swing.text
Class StringContent
- AbstractDocument.Content, Serializable
An implementation of the AbstractDocument.Content interface that is
a brute force implementation that is useful for relatively small
documents and/or debugging. It manages the character content
as a simple character array. It is also quite inefficient.
It is generally recommended that the gap buffer or piece table
implementations be used instead. This buffer does not scale up
to large sizes.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeans
TM
has been added to the
java.beans package.
Please see
XMLEncoder.
StringContent()- Creates a new StringContent object.
|
StringContent(int initialLength)- Creates a new StringContent object, with the initial
size specified.
|
clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringContent
public StringContent()
Creates a new StringContent object. Initial size defaults to 10.
View More Examples of StringContent()
1: protected Document createDefaultModel() {
2: PlainDocument doc = new PlainDocument(new StringContent());
3: undoManager = new UndoManager();
4: doc.addUndoableEditListener(undoManager);
5: return doc;
View Full Code Here
StringContent
public StringContent(int initialLength)
Creates a new StringContent object, with the initial
size specified. If the length is <321, a size of 1 is used.
initialLength - the initial size
getChars
public void getChars(int where,
int len,
Segment chars)
throws BadLocationException Retrieves a portion of the content. where + len must be <= length()
- getChars in interface AbstractDocument.Content
where - the starting position >= 0len - the number of characters to retrieve >= 0chars - the Segment object to return the characters in
getPositionsInRange
protected Vector<E> getPositionsInRange(Vector<E> v,
int offset,
int length) Returns a Vector containing instances of UndoPosRef for the
Positions in the range
offset to
offset +
length.
If
v is not null the matching Positions are placed in
there. The vector with the resulting Positions are returned.
This is meant for internal usage, and is generally not of interest
to subclasses.
v - the Vector to use, with a new one created on nulloffset - the starting offset >= 0length - the length >= 0
updateUndoPositions
protected void updateUndoPositions(Vector<E> positions)
Resets the location for all the UndoPosRef instances
in
positions.
This is meant for internal usage, and is generally not of interest
to subclasses.
positions - the positions of the instances