Interface java.awt.swing.text.AbstractDocument.Content
- Implementing Classes:
- StringContent
- public interface AbstractDocument.Content
Interface to describe a sequence of character content that
can be edited. Implementations may or may not support a
history mechanism which will be reflected by whether or not
mutations return an UndoableEdit implementation.
- See Also:
- AbstractDocument
Method Summary
|
Position
|
createPosition(int offset)
Creates a position within the content that will
track change as the content is mutated.
|
void
|
getChars(int where,
int len,
Segment txt)
Gets a sequence of characters and copies them into a Segment.
|
String
|
getString(int where,
int len)
Fetches a string of characters contained in the sequence.
|
UndoableEdit
|
insertString(int where,
String str)
Inserts a string of characters into the sequence.
|
int
|
length()
Current length of the sequence of character content.
|
UndoableEdit
|
remove(int where,
int nitems)
Removes some portion of the sequence.
|
createPosition
public Position createPosition(int offset) throws BadLocationException
- Creates a position within the content that will
track change as the content is mutated.
- Parameters:
offset
- the offset in the content
- Returns:
- a Position
- Throws:
- BadLocationException - for an invalid offset
length
public int length()
- Current length of the sequence of character content.
- Returns:
- the length
insertString
public UndoableEdit insertString(int where,
String str) throws BadLocationException
- Inserts a string of characters into the sequence.
- Parameters:
where
- Offset into the sequence to make the insertion.
str
- String to insert.
- Returns:
- If the implementation supports a history mechansim,
a reference to an Edit implementation will be returned,
otherwise null.
- Throws:
- BadLocationException - Thrown if the area covered by
the arguments is not contained in the character sequence.
remove
public UndoableEdit remove(int where,
int nitems) throws BadLocationException
- Removes some portion of the sequence.
- Parameters:
where
- The offset into the sequence to make the insertion.
nitems
- The number of items in the sequence to remove.
- Returns:
- If the implementation supports a history mechansim,
a reference to an Edit implementation will be returned,
otherwise null.
- Throws:
- BadLocationException - Thrown if the area covered by
the arguments is not contained in the character sequence.
getString
public String getString(int where,
int len) throws BadLocationException
- Fetches a string of characters contained in the sequence.
- Parameters:
where
- Offset into the sequence to fetch.
len
- number of characters to copy.
- Returns:
- the string
- Throws:
- BadLocationException - Thrown if the area covered by
the arguments is not contained in the character sequence.
getChars
public void getChars(int where,
int len,
Segment txt) throws BadLocationException
- Gets a sequence of characters and copies them into a Segment.
- Parameters:
where
- the starting offset
len
- the number of characters
txt
- the target location to copy into
- Throws:
- BadLocationException - Thrown if the area covered by
the arguments is not contained in the character sequence.
Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.