java.lang.Object
javax.swing.text.View
javax.swing.text.ComponentView
javax.swing.text.html.ObjectView
- 所有已实现的接口:
-
SwingConstants
实现<object>元素的视图接口的组件装饰器。
此视图将尝试加载由classid
属性指定的类。如果可能,将使用用于加载关联文档的类加载器。这通常与用于加载EditorKit的类加载器相同。如果文档的类加载器为null,则使用Class.forName
。
如果类可以成功加载,则将尝试通过调用Class.newInstance
来创建其实例。将尝试将实例缩小为类型java.awt.Component
以显示对象。
此视图还可以管理一组带有限制的参数。预期<object>元素的参数将存在于关联元素的属性集上,设置为简单字符串。将查询每个bean属性作为AttributeSet上的键,期望如果为属性指定了参数,则将存在非null值(类型为String)。使用反射设置参数。目前,这仅限于类型为String的非常简单的单个参数。
一个简单的示例HTML调用是:
<object classid="javax.swing.JLabel"> <param name="text" value="sample text"> </object>
-
Field Summary
Fields declared in class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
Fields declared in interface 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
-
Constructor Summary
-
Method Summary
Methods declared in class javax.swing.text.ComponentView
getAlignment, getComponent, getMaximumSpan, getMinimumSpan, getPreferredSpan, modelToView, paint, setParent, viewToModel
Methods declared in class javax.swing.text.View
append, breakView, changedUpdate, createFragment, forwardUpdate, forwardUpdateToView, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, setSize, updateChildren, updateLayout, viewToModel
-
Constructor Details
-
ObjectView
创建一个新的ObjectView对象。- 参数:
-
elem
- 要装饰的元素
-
-
Method Details
-
createComponent
创建组件。classid用作类名的规范,我们尝试加载它。- 覆盖:
-
createComponent
在类ComponentView
- 返回:
- 与此视图关联的组件
-