| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.swing.text.View
javax.swing.text.PlainView
public class PlainView
实现简单的多行文本视图的 View 接口,该文本视图的文本只有一种字体和颜色。该视图用每个子元素表示文本的某一行。
View| 字段摘要 | |
|---|---|
| protected  FontMetrics | metrics当前字体的字体规格。 | 
| 从类 javax.swing.text.View 继承的字段 | 
|---|
| BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS | 
| 从接口 javax.swing.SwingConstants 继承的字段 | 
|---|
| BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST | 
| 构造方法摘要 | |
|---|---|
| PlainView(Element elem)构造在元素上包装的新 PlainView。 | |
| 方法摘要 | |
|---|---|
|  void | changedUpdate(DocumentEvent changes,
              Shape a,
              ViewFactory f)发出通知,通知文档中此视图负责的某个位置的属性已更改。 | 
| protected  void | damageLineRange(int line0,
                int line1,
                Shape a,
                Component host)重新绘制给定的行范围。 | 
| protected  void | drawLine(int lineIndex,
         Graphics g,
         int x,
         int y)呈现文本的某一行,取消末尾的空白并扩展所有的制表符。 | 
| protected  int | drawSelectedText(Graphics g,
                 int x,
                 int y,
                 int p0,
                 int p1)将模型中给定的范围呈现为选定文本。 | 
| protected  int | drawUnselectedText(Graphics g,
                   int x,
                   int y,
                   int p0,
                   int p1)将模型中给定的范围呈现为正常的未选定文本。 | 
| protected  Segment | getLineBuffer()提供对可用于从相关文档获取文本的缓冲区的访问。 | 
|  float | getPreferredSpan(int axis)确定此视图沿某轴的首选区域。 | 
| protected  int | getTabSize()返回文档中制表符大小的集合,默认值是 8。 | 
|  void | insertUpdate(DocumentEvent changes,
             Shape a,
             ViewFactory f)发出通知,通知在文档中此视图负责的某个位置已插入内容。 | 
| protected  Rectangle | lineToRect(Shape a,
           int line)确定表示给定行的矩形。 | 
|  Shape | modelToView(int pos,
            Shape a,
            Position.Bias b)提供从文档模型坐标空间到所映射的视图坐标空间的映射。 | 
|  float | nextTabStop(float x,
            int tabOffset)在给定引用位置之后,返回下一个制表符停靠位的位置。 | 
|  void | paint(Graphics g,
      Shape a)使用给定呈现面和该表面的区域呈现。 | 
|  void | removeUpdate(DocumentEvent changes,
             Shape a,
             ViewFactory f)通知在文档中此视图负责的某个位置已插入内容。 | 
|  void | setSize(float width,
        float height)设置视图的大小。 | 
| protected  void | updateDamage(DocumentEvent changes,
             Shape a,
             ViewFactory f)重新绘制给定文档事件覆盖的更改区域。 | 
| protected  void | updateMetrics()检查字体规格和最长行是否最新。 | 
|  int | viewToModel(float fx,
            float fy,
            Shape a,
            Position.Bias[] bias)提供从视图坐标空间到该模型的逻辑坐标空间的映射。 | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| 字段详细信息 | 
|---|
protected FontMetrics metrics
| 构造方法详细信息 | 
|---|
public PlainView(Element elem)
elem - 元素| 方法详细信息 | 
|---|
protected int getTabSize()
protected void drawLine(int lineIndex,
                        Graphics g,
                        int x,
                        int y)
drawUnselectedText 和 drawSelectedText,这样可定制呈现选定和未选定文本的方法。
lineIndex - 要绘制的行,该值 >= 0g - Graphics 上下文x - 起始 X 位置,该值 >= 0y - 起始 Y 位置 >= 0drawUnselectedText(java.awt.Graphics, int, int, int, int), 
drawSelectedText(java.awt.Graphics, int, int, int, int)
protected int drawUnselectedText(Graphics g,
                                 int x,
                                 int y,
                                 int p0,
                                 int p1)
                          throws BadLocationException
g - 图形上下文x - 起始 X 坐标,该值 >= 0y - 起始 Y 坐标,该值 >= 0p0 - 模型中的起始位置,该值 >= 0p1 - 模型中的结束位置,该值 >= 0
BadLocationException - 如果范围无效
protected int drawSelectedText(Graphics g,
                               int x,
                               int y,
                               int p0,
                               int p1)
                        throws BadLocationException
g - 图形上下文x - 起始 X 坐标,该值 >= 0y - 起始 Y 坐标,该值 >= 0p0 - 模型中的起始位置,该值 >= 0p1 - 模型中的结束位置,该值 >= 0
BadLocationException - 如果范围无效protected final Segment getLineBuffer()
protected void updateMetrics()
public float getPreferredSpan(int axis)
View 中的 getPreferredSpanaxis - 可以是 View.X_AXIS 或 View.Y_AXIS
IllegalArgumentException - 如果轴无效View.getPreferredSpan(int)
public void paint(Graphics g,
                  Shape a)
View 中的 paintg - 要使用的呈现表面a - 已分配的呈现区域View.paint(java.awt.Graphics, java.awt.Shape)
public Shape modelToView(int pos,
                         Shape a,
                         Position.Bias b)
                  throws BadLocationException
View 中的 modelToViewpos - 要转换的位置,该值 >= 0a - 分配的要在其中呈现的区域b - 当位置是两个视图的边界时,该参数是离由偏移量表示的前一个字符或者下一个字符的偏差;b 将是这些值之一:
 Position.Bias.Forward
 Position.Bias.Backward
 BadLocationException - 如果给定位置在所关联的文档中不是一个有效位置View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)
public int viewToModel(float fx,
                       float fy,
                       Shape a,
                       Position.Bias[] bias)
View 中的 viewToModelfx - X 坐标,该值 >= 0fy - Y 坐标,该值 >= 0a - 要呈现的分配区域
View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
public void insertUpdate(DocumentEvent changes,
                         Shape a,
                         ViewFactory f)
View 中的 insertUpdatechanges - 取自相关文档的更改信息a - 视图的当前分配区域f - 用于重建的工厂(如果该视图有子级)View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public void removeUpdate(DocumentEvent changes,
                         Shape a,
                         ViewFactory f)
View 中的 removeUpdatechanges - 取自相关文档的更改信息a - 视图的当前分配区域f - 用于重建的工厂(如果该视图有子级)View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public void changedUpdate(DocumentEvent changes,
                          Shape a,
                          ViewFactory f)
View 中的 changedUpdatechanges - 取自相关文档的更改信息a - 视图的当前分配区域f - 用于重建的工厂(如果该视图有子级)View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
public void setSize(float width,
                    float height)
View 中的 setSizewidth - 宽度 >= 0height - 宽度 >= 0
public float nextTabStop(float x,
                         int tabOffset)
TabExpander 中的 nextTabStopx - 当前位置,该值 >= 0tabOffset - 下一个流内出现制表符的位置,该值 >= 0。
protected void updateDamage(DocumentEvent changes,
                            Shape a,
                            ViewFactory f)
protected void damageLineRange(int line0,
                               int line1,
                               Shape a,
                               Component host)
host - 承载视图的组件(用于调用 repaint)a - 视图所呈现的分配区域line0 - 要重绘的起始行号。它必须是模型中的有效行号。line1 - 要重绘的结束行号。它必须是模型中的有效行号。
protected Rectangle lineToRect(Shape a,
                               int line)
a - 视图要呈现的分配区域line - 要查找的区域的行号。它必须是模型中的有效行号。| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。