Class ParagraphView
- All Implemented Interfaces:
-
SwingConstants
,TabExpander
public class ParagraphView extends ParagraphView
Nested Class Summary
Nested classes/interfaces declared in class javax.swing.text.FlowView
FlowView.FlowStrategy
Field Summary
Fields declared in class javax.swing.text.ParagraphView
firstLineIndent
Fields declared in class javax.swing.text.FlowView
layoutPool, layoutSpan, strategy
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 |
---|---|
ParagraphView |
Constructs a ParagraphView for the given element. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
protected SizeRequirements |
calculateMinorAxisRequirements |
Calculate the needs for the paragraph along the minor axis. |
AttributeSet |
getAttributes() |
Fetches the attributes to use when rendering. |
float |
getMaximumSpan |
Determines the maximum span for this view along an axis. |
float |
getMinimumSpan |
Determines the minimum span for this view along an axis. |
float |
getPreferredSpan |
Determines the preferred span for this view. |
protected StyleSheet |
getStyleSheet() |
Convenient method to get the StyleSheet. |
boolean |
isVisible() |
Indicates whether or not this view should be displayed. |
void |
paint |
Renders using the given rendering surface and area on that surface. |
void |
setParent |
Establishes the parent view for this view. |
protected void |
setPropertiesFromAttributes() |
Sets up the paragraph from css attributes instead of the values found in StyleConstants (i.e. which are used by the superclass). |
Methods declared in class javax.swing.text.ParagraphView
breakView, changedUpdate, createRow, findOffsetToCharactersInString, flipEastAndWestAtEnds, getAlignment, getBreakWeight, getClosestPositionTo, getFlowSpan, getFlowStart, getLayoutView, getLayoutViewCount, getNextNorthSouthVisualPositionFrom, getPartialSize, getTabBase, getTabSet, nextTabStop, setFirstLineIndent, setJustification, setLineSpacing
Methods declared in class javax.swing.text.FlowView
getFlowAxis, getViewIndexAtPosition, insertUpdate, layout, loadChildren, removeUpdate
Methods declared in class javax.swing.text.BoxView
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, childAllocation, forwardUpdate, getAxis, getChildAllocation, getHeight, getOffset, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, setSize, viewToModel
Methods declared in class javax.swing.text.CompositeView
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, modelToView, setInsets, setParagraphInsets
Methods declared in class javax.swing.text.View
append, breakView, createFragment, forwardUpdateToView, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModel
Constructor Details
ParagraphView
public ParagraphView(Element elem)
- Parameters:
-
elem
- the element that this view is responsible for
Method Details
setParent
public void setParent(View parent)
This is implemented to forward to the superclass as well as call the setPropertiesFromAttributes
method to set the paragraph properties from the css attributes. The call is made at this time to ensure the ability to resolve upward through the parents view attributes.
- Overrides:
-
setParent
in classCompositeView
- Parameters:
-
parent
- the new parent, or null if the view is being removed from a parent it was previously added to
getAttributes
public AttributeSet getAttributes()
- Overrides:
-
getAttributes
in classView
- Returns:
- the attributes to use when rendering
setPropertiesFromAttributes
protected void setPropertiesFromAttributes()
- Overrides:
-
setPropertiesFromAttributes
in classParagraphView
getStyleSheet
protected StyleSheet getStyleSheet()
- Returns:
- the StyleSheet
calculateMinorAxisRequirements
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
If size requirements are explicitly specified for the paragraph, use that requirements. Otherwise, use the requirements of the superclass ParagraphView
.
If the axis
parameter is neither View.X_AXIS
nor View.Y_AXIS
, IllegalArgumentException
is thrown. If the r
parameter is null,
a new SizeRequirements
object is created, otherwise the supplied SizeRequirements
object is returned.
- Overrides:
-
calculateMinorAxisRequirements
in classParagraphView
- Parameters:
-
axis
- the minor axis -
r
- the inputSizeRequirements
object - Returns:
- the new or adjusted
SizeRequirements
object - Throws:
-
IllegalArgumentException
- if theaxis
parameter is invalid - See Also:
isVisible
public boolean isVisible()
paint
public void paint(Graphics g, Shape a)
- Overrides:
-
paint
in classParagraphView
- Parameters:
-
g
- the rendering surface to use -
a
- the allocated region to render into - See Also:
getPreferredSpan
public float getPreferredSpan(int axis)
- Overrides:
-
getPreferredSpan
in classBoxView
- Parameters:
-
axis
- may be either View.X_AXIS or View.Y_AXIS - Returns:
- the span the view would like to be rendered into; typically the view is told to render into the span that is returned, although there is no guarantee; the parent may choose to resize or break the view
- See Also:
getMinimumSpan
public float getMinimumSpan(int axis)
- Overrides:
-
getMinimumSpan
in classBoxView
- Parameters:
-
axis
- may be eitherView.X_AXIS
orView.Y_AXIS
- Returns:
- the minimum span the view can be rendered into
- See Also:
getMaximumSpan
public float getMaximumSpan(int axis)
- Overrides:
-
getMaximumSpan
in classBoxView
- Parameters:
-
axis
- may be eitherView.X_AXIS
orView.Y_AXIS
- Returns:
- the maximum span the view can be rendered into
- See Also:
© 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/ParagraphView.html