Class ObjectView
- All Implemented Interfaces:
SwingConstants
public class ObjectView extends ComponentView
This view will try to load the class specified by the classid
attribute. If possible, the Classloader used to load the associated Document is used. This would typically be the same as the ClassLoader used to load the EditorKit. If the document's ClassLoader is null, Class.forName
is used.
If the class can successfully be loaded, an attempt will be made to create an instance of it by calling Class.newInstance
. An attempt will be made to narrow the instance to type java.awt.Component
to display the object.
This view can also manage a set of parameters with limitations. The parameters to the <object> element are expected to be present on the associated elements attribute set as simple strings. Each bean property will be queried as a key on the AttributeSet, with the expectation that a non-null value (of type String) will be present if there was a parameter specification for the property. Reflection is used to set the parameter. Currently, this is limited to a very simple single parameter of type String.
A simple example HTML invocation is:
<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
Constructor | Description |
---|---|
ObjectView |
Creates a new ObjectView object. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
protected Component |
createComponent() |
Create the component. |
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
public ObjectView(Element elem)
- Parameters:
-
elem
- the element to decorate
Method Details
createComponent
protected Component createComponent()
- Overrides:
-
createComponent
in classComponentView
- Returns:
- the component that is associated with this view
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/text/html/ObjectView.html