JavaTM 2 Platform
Standard Ed. 6

类 javax.swing.text.BadLocationException
的使用

使用 BadLocationException 的软件包
javax.swing 提供一组“轻量级”(全部是 Java 语言)组件,尽量让这些组件在所有平台上的工作方式都相同。 
javax.swing.plaf 提供一个接口和许多抽象类,Swing 用它们来提供自己的可插入外观功能。 
javax.swing.plaf.basic 提供了根据基本外观构建的用户界面对象。 
javax.swing.plaf.multi 提供了组合两个或多个外观的用户界面对象。 
javax.swing.text 提供类 HTMLEditorKit 和创建 HTML 文本编辑器的支持类。 
javax.swing.text.html 提供类 HTMLEditorKit 和创建 HTML 文本编辑器的支持类。 
javax.swing.text.rtf 提供一个类 (RTFEditorKit),用于创建富文本格式(Rich-Text-Format)的文本编辑器。 
 

javax.swingBadLocationException 的使用
 

抛出 BadLocationExceptionjavax.swing 中的方法
 int JTextArea.getLineEndOffset(int line)
          确定给定行结尾处的偏移量。
 int JTextArea.getLineOfOffset(int offset)
          将组件文本中的偏移量转换为行号。
 int JTextArea.getLineStartOffset(int line)
          确定给定行起始处的偏移量。
 String JPasswordField.getText(int offs, int len)
          已过时。 从 Java 2 platform v1.2 开始,由 getPassword 来代替。
 

javax.swing.plafBadLocationException 的使用
 

抛出 BadLocationExceptionjavax.swing.plaf 中的方法
abstract  int TextUI.getNextVisualPositionFrom(JTextComponent t, int pos, Position.Bias b, int direction, Position.Bias[] biasRet)
          提供确定下一个可以放置一个插入符的可见模型位置的方法。
abstract  Rectangle TextUI.modelToView(JTextComponent t, int pos)
          将模型中的给定位置转换成视图坐标系统中的某一个位置。
abstract  Rectangle TextUI.modelToView(JTextComponent t, int pos, Position.Bias bias)
          将模型中的给定位置转换成视图坐标系统中的某一个位置。
 

javax.swing.plaf.basicBadLocationException 的使用
 

抛出 BadLocationExceptionjavax.swing.plaf.basic 中的方法
 int BasicTextUI.getNextVisualPositionFrom(JTextComponent t, int pos, Position.Bias b, int direction, Position.Bias[] biasRet)
          提供确定下一个可以放置一个插入符的可见模型位置的方法。
 Rectangle BasicTextUI.modelToView(JTextComponent tc, int pos)
          将模型中的给定位置转换成视图坐标系统中的某一个位置。
 Rectangle BasicTextUI.modelToView(JTextComponent tc, int pos, Position.Bias bias)
          将模型中的给定位置转换成视图坐标系统中的某一个位置。
 

javax.swing.plaf.multiBadLocationException 的使用
 

抛出 BadLocationExceptionjavax.swing.plaf.multi 中的方法
 int MultiTextUI.getNextVisualPositionFrom(JTextComponent a, int b, Position.Bias c, int d, Position.Bias[] e)
          在由此对象处理的每个 UI 上调用 getNextVisualPositionFrom 方法。
 Rectangle MultiTextUI.modelToView(JTextComponent a, int b)
          在由此对象处理的每个 UI 上调用 modelToView 方法。
 Rectangle MultiTextUI.modelToView(JTextComponent a, int b, Position.Bias c)
          在由此对象处理的每个 UI 上调用 modelToView 方法。
 

javax.swing.textBadLocationException 的使用
 

抛出 BadLocationExceptionjavax.swing.text 中的方法
 Object DefaultHighlighter.addHighlight(int p0, int p1, Highlighter.HighlightPainter p)
          向视图添加高亮显示。
 Object Highlighter.addHighlight(int p0, int p1, Highlighter.HighlightPainter p)
          向视图添加高亮显示。
 void DefaultHighlighter.changeHighlight(Object tag, int p0, int p1)
          更改高亮显示。
 void Highlighter.changeHighlight(Object tag, int p0, int p1)
          更改给定的高亮显示,以使其横跨文档的不同部分。
 Position StringContent.createPosition(int offset)
          在内容中创建一个位置,让其跟踪随内容的变化而进行的更改。
 Position GapContent.createPosition(int offset)
          在内容中创建一个位置,使其在内容发生变化时能跟踪内容的更改。
 Position AbstractDocument.createPosition(int offs)
          返回更改文档时,将跟踪更改的位置。
 Position AbstractDocument.Content.createPosition(int offset)
          在内容中创建一个位置,该位置将在内容改变时跟踪更改。
 Position Document.createPosition(int offs)
          此方法允许应用程序在字符内容序列中标记位置。
protected  int PasswordView.drawSelectedText(Graphics g, int x, int y, int p0, int p1)
          将模型中给定的范围呈现为选定文本。
protected  int WrappedPlainView.drawSelectedText(Graphics g, int x, int y, int p0, int p1)
          将模型中给定的范围呈现为所选文本。
protected  int PlainView.drawSelectedText(Graphics g, int x, int y, int p0, int p1)
          将模型中给定的范围呈现为选定文本。
protected  int PasswordView.drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
          将模型中给定的范围呈现为正常的未选定文本。
protected  int WrappedPlainView.drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
          将模型中的给定范围呈现为普通未选择的文本。
protected  int PlainView.drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
          将模型中给定的范围呈现为正常的未选定文本。
 void StringContent.getChars(int where, int len, Segment chars)
          检索内容的某一部分,where + len 必须 <= length()
 void GapContent.getChars(int where, int len, Segment chars)
          检索部分内容。
 void AbstractDocument.Content.getChars(int where, int len, Segment txt)
          获得字符序列并将其复制到 Segment 中。
protected  int ParagraphView.getClosestPositionTo(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet, int rowIndex, int x)
          返回最接近 x 处的模型位置。
protected  int CompositeView.getNextEastWestVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
          返回光标的下一个可视位置,可以在东或在西。
protected  int CompositeView.getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
          返回光标的下一个可视位置,可以在北也可以在南。
protected  int ParagraphView.getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
          在东或西方向返回光标的下一个可视位置。
 int GlyphView.GlyphPainter.getNextVisualPositionFrom(GlyphView v, int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
          提供确定下一个以可视化形式表示的模型位置的方法,用户可以在此位置放置一个插入符。
 int AsyncBoxView.getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
          提供确定下一个以可视化形式表示的模型位置的方法,用户可以在此位置放置一个插入符。
 int CompositeView.getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
          提供一种方法来确定下一个以可视化形式表示的模型位置,用户可以在此位置放置一个插入符。
 int GlyphView.getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
          提供一种方法来确定下一个以可视化形式表示的模型位置,用户可以在此位置放置一个插入符。
 int View.getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
          提供某种途径来确定可以放置一个插入符的下一个可视表示模型位置。
 int NavigationFilter.getNextVisualPositionFrom(JTextComponent text, int pos, Position.Bias bias, int direction, Position.Bias[] biasRet)
          返回从现在位置起的下一个放置插入符的可视位置。
static int Utilities.getNextWord(JTextComponent c, int offs)
          确定针对给定位置的下一个单词开头。
static int Utilities.getPositionAbove(JTextComponent c, int offs, int x)
          确定模型中离行上方给定的视图位置最近的位置。
static int Utilities.getPositionBelow(JTextComponent c, int offs, int x)
          确定模型中离行下方给定的视图位置最近的位置。
static int Utilities.getPreviousWord(JTextComponent c, int offs)
          确定针对给定位置的上一个单词开头。
static int Utilities.getRowEnd(JTextComponent c, int offs)
          确定包含指定模型位置的行的结束行模型位置。
static int Utilities.getRowStart(JTextComponent c, int offs)
          确定包含指定模型位置的行的起始行模型位置。
 String StringContent.getString(int where, int len)
          检索内容的某一部分,where + len 必须 <= length()。
 String GapContent.getString(int where, int len)
          检索部分内容。
 String AbstractDocument.Content.getString(int where, int len)
          获取序列中包含的字符串。
protected  String AbstractWriter.getText(Element elem)
          返回与该元素关联的文本。
 String JTextComponent.getText(int offs, int len)
          获取由组件表示的文本部分。
 String AbstractDocument.getText(int offset, int length)
          从文档中获得文本序列。
 String Document.getText(int offset, int length)
          获取文档中给定部分包含的文本。
 void AbstractDocument.getText(int offset, int length, Segment txt)
          获取文档给定部分内包含的文本。
 void Document.getText(int offset, int length, Segment txt)
          获取文档中给定部分包含的文本。
static int Utilities.getWordEnd(JTextComponent c, int offs)
          确定针对给定位置的单词结尾。
static int Utilities.getWordStart(JTextComponent c, int offs)
          确定针对给定模型位置的单词开头。
protected  void DefaultStyledDocument.insert(int offset, DefaultStyledDocument.ElementSpec[] data)
          批量插入新元素。
 void DocumentFilter.insertString(DocumentFilter.FilterBypass fb, int offset, String string, AttributeSet attr)
          将文本插入指定的 Document 之前调用。
 UndoableEdit StringContent.insertString(int where, String str)
          将字符串插入到内容中。
 UndoableEdit GapContent.insertString(int where, String str)
          在内容中插入字符串。
 UndoableEdit AbstractDocument.Content.insertString(int where, String str)
          向序列中插入一个字符串。
abstract  void DocumentFilter.FilterBypass.insertString(int offset, String string, AttributeSet attr)
          插入指定的文本,绕过 DocumentFilter。
 void PlainDocument.insertString(int offs, String str, AttributeSet a)
          向文档中插入某些内容。
 void AbstractDocument.insertString(int offs, String str, AttributeSet a)
          将某些内容插入文档。
 void Document.insertString(int offset, String str, AttributeSet a)
          插入内容字符串。
abstract  Shape GlyphView.GlyphPainter.modelToView(GlyphView v, int pos, Position.Bias bias, Shape a)
          提供从文档模型坐标空间到所映射的视图坐标空间的映射。
 Rectangle JTextComponent.modelToView(int pos)
          将模型中给定位置转换为视图坐标系统中的位置。
 Shape CompositeView.modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a)
          提供从文档模型坐标空间到所映射的视图坐标空间的映射。
 Shape View.modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a)
          为给定区域提供从文档模型坐标空间到视图坐标空间的映射。
 Shape View.modelToView(int pos, Shape a)
          已过时。  
 Shape AsyncBoxView.modelToView(int pos, Shape a, Position.Bias b)
          提供从文档模型坐标空间到所映射的视图坐标空间的映射。
 Shape BoxView.modelToView(int pos, Shape a, Position.Bias b)
          提供从文档模型的坐标空间到映射到它的视图的坐标空间的映射。
 Shape ComponentView.modelToView(int pos, Shape a, Position.Bias b)
          提供模型坐标空间到视图坐标空间的映射。
 Shape CompositeView.modelToView(int pos, Shape a, Position.Bias b)
          提供从文档模型坐标空间到所映射的视图坐标空间的映射。
 Shape GlyphView.modelToView(int pos, Shape a, Position.Bias b)
          提供从文档模型坐标空间到所映射的视图坐标空间的映射。
 Shape IconView.modelToView(int pos, Shape a, Position.Bias b)
          提供从文档模型坐标空间到所映射的视图坐标空间的映射。
 Shape PasswordView.modelToView(int pos, Shape a, Position.Bias b)
          提供从文档模型坐标空间到所映射的视图坐标空间的映射。
 Shape FieldView.modelToView(int pos, Shape a, Position.Bias b)
          提供从文档模型坐标空间到所映射的视图坐标空间的映射。
 Shape PlainView.modelToView(int pos, Shape a, Position.Bias b)
          提供从文档模型坐标空间到所映射的视图坐标空间的映射。
abstract  Shape View.modelToView(int pos, Shape a, Position.Bias b)
          为给定字符提供从文档模型坐标空间到视图坐标空间的映射。
 void DefaultEditorKit.read(InputStream in, Document doc, int pos)
          插入取自给定流的内容,其格式需要适合此类型的内容处理程序。
abstract  void EditorKit.read(InputStream in, Document doc, int pos)
          插入来自给定流的内容,其格式需要适合此类型的内容处理程序。
 void DefaultEditorKit.read(Reader in, Document doc, int pos)
          插入取自给定流的内容,它将被视为纯文本。
abstract  void EditorKit.read(Reader in, Document doc, int pos)
          插入来自给定流的内容,其格式需要适合此类型的内容处理程序。
 void DocumentFilter.remove(DocumentFilter.FilterBypass fb, int offset, int length)
          移除指定 Document 中的指定区域之前调用。
abstract  void DocumentFilter.FilterBypass.remove(int offset, int length)
          移除指定的文本区域,绕过 DocumentFilter。
 UndoableEdit StringContent.remove(int where, int nitems)
          移除部分内容,其中 where + nitems 必须 < length()。
 UndoableEdit GapContent.remove(int where, int nitems)
          移除部分内容。
 void AbstractDocument.remove(int offs, int len)
          从文档中移除某些内容。
 UndoableEdit AbstractDocument.Content.remove(int where, int nitems)
          移除该序列的某一部分。
 void Document.remove(int offs, int len)
          移除文档的部分内容。
 void DocumentFilter.replace(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs)
          在替换指定的 Document 中的文本区域之前调用。
abstract  void DocumentFilter.FilterBypass.replace(int offset, int length, String string, AttributeSet attrs)
          删除从 offsetoffset + length 的文本区域,并用 text 替换。
 void AbstractDocument.replace(int offset, int length, String text, AttributeSet attrs)
          删除从 offsetoffset + length 的文本区域,并用 text 替换它。
protected  void AbstractWriter.text(Element elem)
          写出文本。
protected abstract  void AbstractWriter.write()
          需要由子类实现此抽象方法。
 void DefaultEditorKit.write(OutputStream out, Document doc, int pos, int len)
          将文档中的内容以适合此类型内容处理程序的格式写入给定的流。
abstract  void EditorKit.write(OutputStream out, Document doc, int pos, int len)
          将文档中的内容以适合此类型内容处理程序的格式写入给定的流。
 void DefaultEditorKit.write(Writer out, Document doc, int pos, int len)
          将取自文档的内容以纯文本格式写入给定流。
abstract  void EditorKit.write(Writer out, Document doc, int pos, int len)
          将文档中的内容以适合此类型内容处理程序的格式写入给定的流。
 

javax.swing.text.htmlBadLocationException 的使用
 

抛出 BadLocationExceptionjavax.swing.text.html 中的方法
protected  void HTMLWriter.comment(Element elem)
          写出注释。
protected  void HTMLWriter.emptyTag(Element elem)
          写出所有空元素(没有对应结束标记的所有标记)。
 void HTMLDocument.HTMLReader.flush()
          在 reader 上调用的最后一个方法。
 void HTMLEditorKit.ParserCallback.flush()
           
protected  void HTMLDocument.insert(int offset, DefaultStyledDocument.ElementSpec[] data)
          批量插入新元素。
 void HTMLDocument.insertAfterEnd(Element elem, String htmlText)
          将指定为字符串的 HTML 插入给定元素的起始处之后。
 void HTMLDocument.insertAfterStart(Element elem, String htmlText)
          将指定为字符串的 HTML 插入元素的起始处。
 void HTMLDocument.insertBeforeEnd(Element elem, String htmlText)
          将指定为字符串的 HTML 插入元素的结尾处。
 void HTMLDocument.insertBeforeStart(Element elem, String htmlText)
          将指定为字符串的 HTML 插入给定元素的起始处之前。
 void HTMLEditorKit.insertHTML(HTMLDocument doc, int offset, String html, int popDepth, int pushDepth, HTML.Tag insertTag)
          将 HTML 插入现有文档。
 Shape ImageView.modelToView(int pos, Shape a, Position.Bias b)
          提供从文档模型坐标空间到所映射的视图坐标空间的映射。
 void HTMLEditorKit.read(Reader in, Document doc, int pos)
          插入来自给定流的内容。
 void HTMLDocument.setInnerHTML(Element elem, String htmlText)
          用指定为 HTML 字符串的内容替换给定元素的子元素。
 void HTMLDocument.setOuterHTML(Element elem, String htmlText)
          用指定为 HTML 字符串的内容替换父元素中的给定元素。
protected  void HTMLWriter.startTag(Element elem)
          写出元素的开始标记。
protected  void HTMLWriter.text(Element elem)
          写出文本。
protected  void MinimalHTMLWriter.text(Element elem)
          写出文本。
protected  void HTMLWriter.textAreaContent(AttributeSet attr)
          写出 TEXTAREA 表单元素中所包含的文本。
 void HTMLWriter.write()
          对 Element 树进行迭代并控制所有标记及其属性的写出。
 void MinimalHTMLWriter.write()
          从 StyledDocument 生成 HTML 输出。
 void HTMLEditorKit.write(Writer out, Document doc, int pos, int len)
          以适合此类内容处理程序的格式,将文档中的内容写入给定流。
protected  void MinimalHTMLWriter.writeBody()
          对文档中的元素进行迭代,并基于元素是分支元素还是叶元素来处理它们。
protected  void MinimalHTMLWriter.writeContent(Element elem, boolean needsIndenting)
          以与 HTML 兼容的方式写出属性集。
 

javax.swing.text.rtfBadLocationException 的使用
 

抛出 BadLocationExceptionjavax.swing.text.rtf 中的方法
 void RTFEditorKit.read(InputStream in, Document doc, int pos)
          插入来自给定流的内容,该内容的格式需要适合于此类内容处理程序。
 void RTFEditorKit.read(Reader in, Document doc, int pos)
          插入来自给定流的内容,该内容将被视为纯文本。
 void RTFEditorKit.write(OutputStream out, Document doc, int pos, int len)
          以适合此类内容处理程序的格式,将文档中的内容写入给定流。
 void RTFEditorKit.write(Writer out, Document doc, int pos, int len)
          将文档中的内容作为纯文本写入给定的流。
 


JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only