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 -起始位置> = 0
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.ForwardPosition.Bias.BackwardBadLocationException -如果给定的位置不在相关文件表示一个有效的位置
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.