public class PlainView extends View implements TabExpander
View 
       | Modifier and Type | Field and Description | 
|---|---|
| protected FontMetrics | metrics
              当前字体的字体指标。 
             | 
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXISBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST| Modifier and Type | Method and Description | 
|---|---|
| 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)
              提供从视图坐标空间到模型的逻辑坐标空间的映射。 
             | 
append, breakView, createFragment, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, updateChildren, updateLayout, viewToModelprotected FontMetrics metrics
public PlainView(Element elem)
elem - 元素 
           protected int getTabSize()
protected void drawLine(int lineIndex,
                        Graphics g,
                        int x,
                        int y) 
          drawUnselectedText和drawSelectedText ,以便可以自定义选择和未选择的文本的方式。 
          lineIndex - 绘制线> = 0 
           g - 
            Graphics上下文 
           x - 起始X位置> = 0 
           y - 起始Y位置> = 0 
           drawUnselectedText(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坐标> = 0 
           y - 起始Y坐标> = 0 
           p0 - 模型中的起始位置> = 0 
           p1 - 模型中的结束位置> = 0 
           BadLocationException - 如果范围无效 
           protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException
g - 图形上下文 
           x - 起始X坐标> = 0 
           y - 起始Y坐标> = 0 
           p0 - 模型中的起始位置> = 0 
           p1 - 模型中的结束位置> = 0 
           BadLocationException - 范围无效 
           protected final Segment getLineBuffer()
protected void updateMetrics()
public float getPreferredSpan(int axis)
getPreferredSpan在 
            View 
           axis - 可以是View.X_AXIS或View.Y_AXIS 
           IllegalArgumentException - 对于无效轴 
           View.getPreferredSpan(int) 
           public void paint(Graphics g, Shape a)
paint在 
            View 
           g - 要使用的渲染表面 
           a - 要分配的区域 
           View.paint(java.awt.Graphics, java.awt.Shape) 
           public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException
modelToView在 
            View 
           pos - 转换> = 0的位置 
           a - 要分配的区域 
           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) 
          viewToModel在 
            View 
           fx - X坐标> = 0 
           fy - Y坐标> = 0 
           a - 要分配的区域 
           View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) 
           public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory f)
insertUpdate在 
            View类 
           changes - 相关文件的变更信息 
           a - 视图的当前分配 
           f - 工厂用来重建如果视图有孩子 
           View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) 
           public void removeUpdate(DocumentEvent changes, Shape a, ViewFactory f)
removeUpdate在 
            View 
           changes - 相关文件的变更信息 
           a - 视图的当前分配 
           f - 工厂使用重建如果视图有孩子 
           View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) 
           public void changedUpdate(DocumentEvent changes, Shape a, ViewFactory f)
changedUpdate在 
            View 
           changes - 相关文件的变更信息 
           a - 视图的当前分配 
           f - 工厂用来重建如果视图有孩子 
           View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) 
           public void setSize(float width,
                    float height) 
          public float nextTabStop(float x,
                         int tabOffset) 
          nextTabStop在界面 
            TabExpander 
           x - 当前位置> = 0 
           tabOffset - 标签出现在> = 0的文本流内的位置。 
           protected void updateDamage(DocumentEvent changes, Shape a, ViewFactory f)
protected void damageLineRange(int line0,
                               int line1,
                               Shape a,
                               Component host) 
          host - 托管视图的组件(用于调用重绘) 
           a - 分配给视图进行渲染的区域 
           line0 - 要重绘的起始行号。 
            这必须是模型中有效的行号。 
           line1 - 要重画的结束行号。 
            这必须是模型中有效的行号。 
            Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.