-  
       
- 所有已知实现类:
 -  
         
GapContent,StringContent 
- Enclosing class:
 - AbstractDocument
 
public static interface AbstractDocument.Content用于描述可编辑的字符内容序列的界面。 实现可能支持也可能不支持历史机制,这些机制将通过突变是否返回UndoableEdit实现来反映。- 另请参见:
 -  
         
AbstractDocument 
 
-  
        
       
-  
             
方法摘要
所有方法 实例方法 抽象方法 变量和类型 方法 描述 PositioncreatePosition(int offset)在内容中创建一个位置,以便在内容发生变化时跟踪更改。voidgetChars(int where, int len, Segment txt)获取一系列字符并将其复制到Segment中。StringgetString(int where, int len)获取序列中包含的字符串。UndoableEditinsertString(int where, String str)在序列中插入一串字符。intlength()字符内容序列的当前长度。UndoableEditremove(int where, int nitems)删除序列的某些部分。 
 -  
             
 
-  
        
       
-  
             
方法详细信息
-  
createPosition
Position createPosition(int offset) throws BadLocationException
在内容中创建一个位置,以便在内容发生变化时跟踪更改。- 参数
 -  
              
offset- 内容中的偏移量> = 0 - 结果
 - 一个位置
 - 异常
 -  
              
BadLocationException- 对于无效的偏移量 
 
-  
length
int length()
字符内容序列的当前长度。- 结果
 - 长度> = 0
 
 
-  
insertString
UndoableEdit insertString(int where, String str) throws BadLocationException
在序列中插入一串字符。- 参数
 -  
              
where- 进入序列的偏移量使插入> = 0 -  
              
str- 要插入的字符串 - 结果
 - 
               如果实现支持历史记录机制,将返回对 
              
Edit实现的引用,否则返回null - 异常
 -  
              
BadLocationException- 如果参数覆盖的区域未包含在字符序列中,则抛出此异常 
 
-  
remove
UndoableEdit remove(int where, int nitems) throws BadLocationException
删除序列的某些部分。- 参数
 -  
              
where- 插入序列的偏移量> = 0。 -  
              
nitems- 要删除的序列中的项目数> = 0。 - 结果
 - 如果实现支持历史记录机制,则将返回对Edit实现的引用,否则返回null。
 - 异常
 -  
              
BadLocationException- 如果参数覆盖的区域未包含在字符序列中,则抛出该异常。 
 
-  
getString
String getString(int where, int len) throws BadLocationException
获取序列中包含的字符串。- 参数
 -  
              
where- 偏移到序列中以获取> = 0。 -  
              
len- 要复制的字符数> = 0。 - 结果
 - 字符串
 - 异常
 -  
              
BadLocationException- 如果参数覆盖的区域未包含在字符序列中,则抛出该异常。 
 
-  
getChars
void getChars(int where, int len, Segment txt) throws BadLocationException获取一系列字符并将其复制到Segment中。- 参数
 -  
              
where- 起始偏移量> = 0 -  
              
len- 字符数> = 0 -  
              
txt- 要复制到的目标位置 - 异常
 -  
              
BadLocationException- 如果参数覆盖的区域未包含在字符序列中,则抛出该异常。 
 
 -  
 
 -