|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.swing.text.View
javax.swing.text.CompositeView
javax.swing.text.BoxView
javax.swing.text.FlowView
javax.swing.text.ParagraphView
public class ParagraphView
存在簡單換行的段落的視圖,其支持多種字體、顏色、元件、圖標等。它基本上是周圍有空白的縱向框。該框的內容是一組行,這些行是特殊的橫向框。此視圖創建表示段落元素的子元素的視圖集合。如果這些視圖合適,則可將其中的每個視圖直接放到行中;否則,將調用 breakView 方法嘗試將視圖切割成合適的片段。
View| 巢狀類別摘要 |
|---|
| 從類別 javax.swing.text.FlowView 繼承的巢狀類別/介面 |
|---|
FlowView.FlowStrategy |
| 欄位摘要 | |
|---|---|
protected int |
firstLineIndent
相對於左邊的 inset 進行的第一行的縮進。 |
| 從類別 javax.swing.text.FlowView 繼承的欄位 |
|---|
layoutPool, layoutSpan, strategy |
| 從類別 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 |
| 建構子摘要 | |
|---|---|
ParagraphView(Element elem)
創建給定元素的 ParagraphView。 |
|
| 方法摘要 | |
|---|---|
protected void |
adjustRow(javax.swing.text.ParagraphView.Row r,
int desiredSpan,
int x)
如有可能,調整給定行以使其處於佈局區域內。 |
View |
breakView(int axis,
float len,
Shape a)
以給定的長度在給定的軸上拆分此視圖。 |
void |
changedUpdate(DocumentEvent changes,
Shape a,
ViewFactory f)
發出通知,通知文檔中此視圖負責的某個位置的屬性已更改。 |
protected View |
createRow()
創建用於在串流中存儲子級行值的 View。 |
protected int |
findOffsetToCharactersInString(char[] string,
int start)
根據 string 中字元尋找文檔中的下一個字元,起點是偏移量 start。 |
protected boolean |
flipEastAndWestAtEnds(int position,
Position.Bias bias)
確定下一個視圖要佈置的方向。 |
float |
getAlignment(int axis)
確定此視圖沿某軸所需的對齊方式。 |
int |
getBreakWeight(int axis,
float len)
獲取給定位置的拆分權重。 |
protected int |
getClosestPositionTo(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet,
int rowIndex,
int x)
返回最接近 x 處的模型位置。 |
int |
getFlowSpan(int index)
獲取給定子索引串流入的約束區域。 |
int |
getFlowStart(int index)
獲取沿串流軸的串流區域開始位置。 |
protected View |
getLayoutView(int index)
返回給定 index 處的視圖。 |
protected int |
getLayoutViewCount()
返回此視圖負責的視圖數。 |
protected int |
getNextNorthSouthVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
在東或西方向返回鼠標的下一個可視位置。 |
protected float |
getPartialSize(int startOffset,
int endOffset)
返回 startOffset 和 endOffset 之間的視圖使用的大小。 |
protected float |
getTabBase()
返回從中計算製表符的位置。 |
protected TabSet |
getTabSet()
獲取計算製表符時使用的 Tabset。 |
float |
nextTabStop(float x,
int tabOffset)
返回給定了參照位置的下一個製表符位位置。 |
void |
paint(Graphics g,
Shape a)
使用給定的呈現面和該面上的區域進行呈現。 |
protected void |
setFirstLineIndent(float fi)
設置第一行的行縮進量。 |
protected void |
setJustification(int j)
設置對齊方式的型別。 |
protected void |
setLineSpacing(float ls)
設置行間距。 |
protected void |
setPropertiesFromAttributes()
從屬性集設置快取記憶體的屬性。 |
| 從類別 javax.swing.text.FlowView 繼承的方法 |
|---|
calculateMinorAxisRequirements, getFlowAxis, getViewIndexAtPosition, insertUpdate, layout, loadChildren, removeUpdate, setParent |
| 從類別 javax.swing.text.View 繼承的方法 |
|---|
append, breakView, createFragment, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModel |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 欄位詳細資訊 |
|---|
protected int firstLineIndent
| 建構子詳細資訊 |
|---|
public ParagraphView(Element elem)
ParagraphView。
elem - 此視圖負責的元素| 方法詳細資訊 |
|---|
protected void setJustification(int j)
j - 為下列值之一:
StyleConstants.ALIGN_LEFT
StyleConstants.ALIGN_CENTER
StyleConstants.ALIGN_RIGHT
protected void setLineSpacing(float ls)
ls - 該值為行高的因子protected void setFirstLineIndent(float fi)
fi - 以磅 (point) 為單位的值protected void setPropertiesFromAttributes()
protected int getLayoutViewCount()
View 片段的行。這是平鋪在兩個維數之間的視圖數,此數應等於此視圖負責的元素的子元素數。
ParagraphView 負責的視圖數protected View getLayoutView(int index)
index 處的視圖。段落的子視圖是已用於安排表示子元素的 View 片段的行。此方法返回負責子元素索引的視圖(拆分前)。這些是從處理器產生(以表示子元素)且用於佈局的 View。
index - 所需視圖的 index
index 處的視圖
protected void adjustRow(javax.swing.text.ParagraphView.Row r,
int desiredSpan,
int x)
這是內部用法,不應直接使用。
r - 要調整到當前佈局區域內的行desiredSpan - 當前佈局區域,該值 >= 0x - r 開始處的位置
protected int getNextNorthSouthVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
throws BadLocationException
CompositeView 覆寫。
CompositeView 中的 getNextNorthSouthVisualPositionFrompos - 模型中的位置b - Position.Bias.Forward 或 Position.Bias.Backwarda - 要呈現的分派區域direction - SwingConstants.NORTH 或 SwingConstants.SOUTHbiasRet - 套件含以此方法查到的偏差的陣列
BadLocationExceptionCompositeView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[])
protected int getClosestPositionTo(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet,
int rowIndex,
int x)
throws BadLocationException
x 處的模型位置。rowIndex 是要在其中尋找的視圖對應的索引。
pos - 模型中的位置a - 要呈現的分派區域direction - 它是以下值之一:
SwingConstants.NORTH
SwingConstants.SOUTH
biasRet - 套件含在此方法中查到的偏差的陣列rowIndex - 視圖的索引x - 需要的 x 坐標
x 的模型位置
BadLocationException
protected boolean flipEastAndWestAtEnds(int position,
Position.Bias bias)
View 位於索引 n 處,通常 View 是從左向右放置的,所以在東面的 View 將位於索引 n + 1 處,在西面的 View 將位於索引 n - 1 處。在某些情況下(例如雙向文本中)有可能東面的 View 不是位於 n + 1 處,而是位於 n - 1 處,或者西面的 View 不是位於 n - 1 處,而是位於索引 n + 1 處。這種情況下,該方法將返回 true,指示 View 按降序放置。
如果文本在某個位置從右向左佈置,則返回 true;否則返回 false。
BoxView 中的 flipEastAndWestAtEndsposition - 模型中的位置bias - Position.Bias.Forward 或 Position.Bias.Backward
public int getFlowSpan(int index)
FlowView 中的 getFlowSpanindex - 查詢視圖的索引
index 處給定視圖的約束區域FlowView.getFlowStart(int)public int getFlowStart(int index)
FlowView 中的 getFlowStartindex - 查詢視圖的索引
index 處給定視圖的位置FlowView.getFlowSpan(int)protected View createRow()
View。
FlowView 中的 createRowView
public float nextTabStop(float x,
int tabOffset)
getTabbedSpan,以確定該子級所需的區域。邏輯子級可以將其製表符擴展委託給知道如何擴展製表符的段落。LabelView 是將其製表符擴展需要委託給段落的視圖的範例。
實作此方法以嘗試在段落元素的屬性集合中尋找 TabSet。如果能找到一個製表符集,將使用其設置;否則將提供預設擴展。製表符擴展的基本位置是段落左部最近分派的位置(即子級佈局的依據)。
TabExpander 中的 nextTabStopx - X 參考位置tabOffset - 在文本串流內放置製表符的位置,該值 >= 0
TabSet,
TabStop,
LabelViewprotected TabSet getTabSet()
Tabset。
TabSet
protected float getPartialSize(int startOffset,
int endOffset)
startOffset 和 endOffset 之間的視圖使用的大小。如果子視圖實作 TabableView 介面,則此方法將使用 getPartialView 計算該大小。如果需要某個大小,並且 View 未實作 TabableView 介面,則使用 preferredSpan。
startOffset - 起始文檔偏移量,該值 >= 0endOffset - 結束文檔偏移量,該值 >= startOffset
protected int findOffsetToCharactersInString(char[] string,
int start)
string 中字元尋找文檔中的下一個字元,起點是偏移量 start。如果找不到字元,則返回 -1。
string - 由字元組成的字元串start - 模型中的起始位置,該值 >= 0
protected float getTabBase()
public void paint(Graphics g,
Shape a)
BoxView 中的 paintg - 要使用的呈現表面a - 分派的要在其中呈現的區域View.paint(java.awt.Graphics, java.awt.Shape)public float getAlignment(int axis)
BoxView 中的 getAlignmentaxis - 可以是 View.X_AXIS,也可以是 View.Y_AXIS
public View breakView(int axis,
float len,
Shape a)
ParagraphView 實例只可沿 Y_AXIS 且只在 len 位於第一行之後時拆分。
axis - 可以是 View.X_AXIS,也可以是 View.Y_AXISlen - 指定沿給定軸可能需要拆分的位置,該值 >= 0a - 視圖的當前分派區域
View.breakView(int, int, float, float)
public int getBreakWeight(int axis,
float len)
ParagraphView 實例只沿 Y_AXIS 且只在 len 位於第一行之後拆分。如果長度小於一行,則返回 BadBreakWeight 的值。
axis - 可以是 View.X_AXIS,也可以是 View.Y_AXISlen - 指定可能需要拆分的位置,該值 >= 0
GoodBreakWeight 或 BadBreakWeightView.getBreakWeight(int, float, float)
public void changedUpdate(DocumentEvent changes,
Shape a,
ViewFactory f)
FlowView 中的 changedUpdatechanges - 來自相關文檔的更改資訊a - 視圖的當前分派區域f - 用於重建的處理器(如果該視圖有子級)View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。