|
JavaTM 2 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 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。