public class ObjectView extends ComponentView
此视图将尝试加载由classid
属性指定的类。 如果可能,使用用于加载关联文档的类加载器。 这通常与用于加载EditorKit的ClassLoader相同。 如果文档的ClassLoader为null,则使用Class.forName
。
如果该类可以成功加载,那么将尝试通过调用Class.newInstance
创建一个实例。 将尝试将实例缩小到类型java.awt.Component
以显示对象。
此视图还可以管理一组限制的参数。 预期<object>元素的参数将作为简单字符串设置在关联的元素属性中。 每个bean属性将作为AttributeSet的关键字进行查询,如果存在属性的参数规范,则期望非空值(String类型)。 反射用于设置参数。 目前,这仅限于String类型的非常简单的单一参数。
一个简单的示例HTML调用是:
<object classid="javax.swing.JLabel">
<param name="text" value="sample text">
</object>
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor and Description |
---|
ObjectView(Element elem)
创建一个新的ObjectView对象。
|
Modifier and Type | Method and Description |
---|---|
protected Component |
createComponent()
创建组件。
|
getAlignment, getComponent, getMaximumSpan, getMinimumSpan, getPreferredSpan, modelToView, paint, setParent, viewToModel
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
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.