所有类


javax.swing.text
类 ParagraphView

java.lang.Object
  继承者 javax.swing.text.View
      继承者 javax.swing.text.CompositeView
          继承者 javax.swing.text.BoxView
              继承者 javax.swing.text.FlowView
                  继承者 javax.swing.text.ParagraphView
所有已实现的接口:
SwingConstants, TabExpander
直接已知子类:
ParagraphView

public class ParagraphView
   
   
   
   
extends FlowView
implements TabExpander

存在简单换行的段落的视图,其支持多种字体、颜色、组件、图标等。它基本上是周围有空白的纵向框。该框的内容是一组行,这些行是特殊的横向框。此视图创建表示段落元素的子元素的视图集合。如果这些视图合适,则可将其中的每个视图直接放到行中;否则,将调用 breakView 方法尝试将视图切割成合适的片段。

另请参见:
View

嵌套类摘要
 
从类 javax.swing.text.FlowView 继承的嵌套类/接口
FlowView.FlowStrategy
 
字段摘要
protected  intfirstLineIndent
          相对于左边的 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  voidadjustRow(javax.swing.text.ParagraphView.Row r, int desiredSpan, int x)
          如有可能,调整给定行以使其处于布局区域内。
 ViewbreakView(int axis, float len, Shape a)
          以给定的长度在给定的轴上拆分此视图。
 voidchangedUpdate(DocumentEvent changes, Shape a, ViewFactory f)
          发出通知,通知文档中此视图负责的某个位置的属性已更改。
protected  ViewcreateRow()
          创建用于在流中存储子级行值的 View
protected  intfindOffsetToCharactersInString(char[] string, int start)
          根据 string 中字符查找文档中的下一个字符,起点是偏移量 start
protected  booleanflipEastAndWestAtEnds(int position, Position.Bias bias)
          确定下一个视图要布置的方向。
 floatgetAlignment(int axis)
          确定此视图沿某轴所需的对齐方式。
 intgetBreakWeight(int axis, float len)
          获取给定位置的拆分权重。
protected  intgetClosestPositionTo(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet, int rowIndex, int x)
          返回最接近 x 处的模型位置。
 intgetFlowSpan(int index)
          获取给定子索引流入的约束区域。
 intgetFlowStart(int index)
          获取沿流轴的流区域开始位置。
protected  ViewgetLayoutView(int index)
          返回给定 index 处的视图。
protected  intgetLayoutViewCount()
          返回此视图负责的视图数。
protected  intgetNextNorthSouthVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
          在东或西方向返回光标的下一个可视位置。
protected  floatgetPartialSize(int startOffset, int endOffset)
          返回 startOffsetendOffset 之间的视图使用的大小。
protected  floatgetTabBase()
          返回从中计算制表符的位置。
protected  TabSetgetTabSet()
          获取计算制表符时使用的 Tabset
 floatnextTabStop(float x, int tabOffset)
          返回给定了参照位置的下一个制表符位位置。
 voidpaint(Graphics g, Shape a)
          使用给定的呈现面和该面上的区域进行呈现。
protected  voidsetFirstLineIndent(float fi)
          设置第一行的行缩进量。
protected  voidsetJustification(int j)
          设置对齐方式的类型。
protected  voidsetLineSpacing(float ls)
          设置行间距。
protected  voidsetPropertiesFromAttributes()
          从属性集设置缓存的属性。
 
从类 javax.swing.text.FlowView 继承的方法
calculateMinorAxisRequirements, getFlowAxis, getViewIndexAtPosition, insertUpdate, layout, loadChildren, removeUpdate, setParent
 
从类 javax.swing.text.BoxView 继承的方法
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, childAllocation, forwardUpdate, getAxis, getChildAllocation, getHeight, getMaximumSpan, getMinimumSpan, getOffset, getPreferredSpan, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, setSize, viewToModel
 
从类 javax.swing.text.CompositeView 继承的方法
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, modelToView, setInsets, setParagraphInsets
 
从类 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
 

字段详细信息

firstLineIndent

protected int firstLineIndent
相对于左边的 inset 进行的第一行的缩进。

构造方法详细信息

ParagraphView

public ParagraphView(Element elem)
创建给定元素的 ParagraphView

参数:
elem - 此视图负责的元素
方法详细信息

setJustification

protected void setJustification(int j)
设置对齐方式的类型。

参数:
j - 为下列值之一:
  • StyleConstants.ALIGN_LEFT
  • StyleConstants.ALIGN_CENTER
  • StyleConstants.ALIGN_RIGHT

setLineSpacing

protected void setLineSpacing(float ls)
设置行间距。

参数:
ls - 该值为行高的因子

setFirstLineIndent

protected void setFirstLineIndent(float fi)
设置第一行的行缩进量。

参数:
fi - 以磅 (point) 为单位的值

setPropertiesFromAttributes

protected void setPropertiesFromAttributes()
从属性集设置缓存的属性。


getLayoutViewCount

protected int getLayoutViewCount()
返回此视图负责的视图数。段落的子视图是已用于安排表示子元素的 View 片段的行。这是平铺在两个维数之间的视图数,此数应等于此视图负责的元素的子元素数。

返回:
ParagraphView 负责的视图数

getLayoutView

protected View getLayoutView(int index)
返回给定 index 处的视图。段落的子视图是已用于安排表示子元素的 View 片段的行。此方法返回负责子元素索引的视图(拆分前)。这些是从工厂生成(以表示子元素)且用于布局的 View。

参数:
index - 所需视图的 index
返回:
index 处的视图

adjustRow

protected void adjustRow(javax.swing.text.ParagraphView.Row r,
                         int desiredSpan,
                         int x)
如有可能,调整给定行以使其处于布局区域内。默认情况下,此操作将试图能在最接近行结尾的位置找到最高拆分权重。如果遇到强制拆分,则该拆分将定位于强制拆分的位置。

这是内部用法,不应直接使用。

参数:
r - 要调整到当前布局区域内的行
desiredSpan - 当前布局区域,该值 >= 0
x - r 开始处的位置