This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing.text
interface AbstractDocument.Content

All Known Implementing Classes:
GapContent, StringContent

public static 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.


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

          Current length of the sequence of character content.
 UndoableEdit
remove(int where, int nitems)

          Removes some portion of the sequence.
 

Method Detail

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 >= 0
Returns:
a Position
Throws:
BadLocationException - for an invalid offset

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 >= 0
len - the number of characters >= 0
txt - the target location to copy into
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 >= 0.
len - number of characters to copy >= 0.
Returns:
the string
Throws:
BadLocationException - Thrown if the area covered by the arguments is not contained in the character sequence.

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 >= 0
str - string to insert
Returns:
if the implementation supports a history mechanism, a reference to an Edit implementation will be returned, otherwise returns null
Throws:
BadLocationException - thrown if the area covered by the arguments is not contained in the character sequence

length

public int length()
Current length of the sequence of character content.

Returns:
the length >= 0

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 >= 0.
nitems - The number of items in the sequence to remove >= 0.
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.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.