All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Interface java.awt.swing.text.AbstractDocument.Content

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 Index

 o createPosition(int)
Create a position within the content that will track change as the content is mutated.
 o getChars(int, int, Segment)
Gets a sequence of characters and copies them into a Segment.
 o getString(int, int)
Fetch a string of characters contained in the sequence.
 o insertString(int, String)
Insert a string of characters into the sequence.
 o length()
Current length of the sequence of character content.
 o remove(int, int)
Remove some portion of the sequence.

Methods

 o createPosition
public abstract Position createPosition(int offset) throws BadLocationException
Create 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
 o length
public abstract int length()
Current length of the sequence of character content.

Returns:
the length
 o insertString
public abstract UndoableEdit insertString(int where,
                                          String str) throws BadLocationException
Insert 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.
 o remove
public abstract UndoableEdit remove(int where,
                                    int nitems) throws BadLocationException
Remove 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.
 o getString
public abstract String getString(int where,
                                 int len) throws BadLocationException
Fetch 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.
 o getChars
public abstract 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.

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature