javax.swing.text
public class ComponentView extends View
Component that should be rendered. This Component
becomes a direct child of the JTextComponent that contains
this ComponentView, so this view must not be shared between
multiple JTextComponents.
| Constructor Summary | |
|---|---|
| ComponentView(Element elem)
Creates a new instance of ComponentView for the specified
Element.
| |
| Method Summary | |
|---|---|
| protected Component | createComponent()
Creates the Component that this View is
rendering. |
| float | getAlignment(int axis)
Returns the alignment of this View along the specified axis.
|
| Component | getComponent()
Returns the Component that is rendered by this
ComponentView.
|
| float | getMaximumSpan(int axis)
Returns the maximum span of this View along the specified
axis.
|
| float | getMinimumSpan(int axis) |
| float | getPreferredSpan(int axis) |
| Shape | modelToView(int pos, Shape a, Position.Bias b) |
| void | paint(Graphics g, Shape a)
The real painting behavour is performed by normal component painting,
triggered by the text component that hosts this view. |
| void | setParent(View p)
This sets up the component when the view is added to its parent, or
cleans up the view when it is removed from its parent.
|
| int | viewToModel(float x, float y, Shape a, Position.Bias[] b)
Maps coordinates from the View's space into a position
in the document model.
|
ComponentView for the specified
Element.
Parameters: elem the element that this View is rendering
Component that this View is
rendering. The Component is determined using
the {@link StyleConstants#ComponentAttribute} of the associated
Element.
Returns: the component that is rendered
View along the specified axis.
Parameters: axis either {@link View#X_AXIS} or {@link View#Y_AXIS}
Returns: the alignment of this View along the specified axis
Component that is rendered by this
ComponentView.
Returns: the Component that is rendered by this
ComponentView
View along the specified
axis.
This will return {@link Component#getMaximumSize()} for the specified
axis.
Returns: the maximum span of this View along the specified
axis
Parameters: g the graphics context a the allocation of the child
p is
null, then the view is removed from it's parent and we have
to also remove the component from it's parent container.
Parameters: p the parent view or null if this view is removed
from it's parent
View's space into a position
in the document model.
Parameters: x the x coordinate in the view space y the y coordinate in the view space a the allocation of this View b the bias to use
Returns: the position in the document that corresponds to the screen
coordinates x, y