- java.lang.Object
-
- javax.swing.text.View
-
- javax.swing.text.ComponentView
-
- javax.swing.text.html.ObjectView
-
- All Implemented Interfaces:
- SwingConstants
public class ObjectView extends ComponentView
Component decorator that implements the view interface for <object> elements.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 typejava.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 inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
-
Fields inherited from 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
Constructors Constructor and Description ObjectView(Element elem)
Creates a new ObjectView object.
-
Method Summary
Methods Modifier and Type Method and Description protected Component
createComponent()
Create the component.-
Methods inherited from class javax.swing.text.ComponentView
getAlignment, getComponent, getMaximumSpan, getMinimumSpan, getPreferredSpan, modelToView, paint, setParent, viewToModel
-
Methods inherited from 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 Detail
-
ObjectView
public ObjectView(Element elem)
Creates a new ObjectView object.- Parameters:
elem
- the element to decorate
-
-
Method Detail
-
createComponent
protected Component createComponent()
Create the component. The classid is used as a specification of the classname, which we try to load.- Overrides:
createComponent
in classComponentView
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/swing/text/html/objectview.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.