SwingConstants
, TabExpander
public class WrappedPlainView extends BoxView implements TabExpander
The line views do all of their rendering through the drawLine
method which in turn does all of its rendering through the drawSelectedText
and drawUnselectedText
methods. This enables subclasses to easily specialize the rendering without concern for the layout aspects.
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 | Description |
---|---|
WrappedPlainView |
Creates a new WrappedPlainView. |
WrappedPlainView |
Creates a new WrappedPlainView. |
Modifier and Type | Method | Description |
---|---|---|
protected int |
calculateBreakPosition |
This is called by the nested wrapped line views to determine the break location. |
void |
changedUpdate |
Gives notification from the document that attributes were changed in a location that this view is responsible for. |
protected void |
drawLine |
Renders a line of text, suppressing whitespace at the end and expanding any tabs. |
protected void |
drawLine |
Deprecated. |
protected float |
drawSelectedText |
Renders the given range in the model as selected text. |
protected int |
drawSelectedText |
Deprecated. |
protected float |
drawUnselectedText |
Renders the given range in the model as normal unselected text. |
protected int |
drawUnselectedText |
Deprecated. |
protected final Segment |
getLineBuffer() |
Gives access to a buffer that can be used to fetch text from the associated document. |
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 along an axis. |
protected int |
getTabSize() |
Returns the tab size set for the document, defaulting to 8. |
void |
insertUpdate |
Gives notification that something was inserted into the document in a location that this view is responsible for. |
protected void |
loadChildren |
Loads all of the children to initialize the view. |
float |
nextTabStop |
Returns the next tab stop position after a given reference position. |
void |
paint |
Renders using the given rendering surface and area on that surface. |
void |
removeUpdate |
Gives notification that something was removed from the document in a location that this view is responsible for. |
void |
setSize |
Sets the size of the view. |
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, calculateMinorAxisRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAlignment, getAxis, getChildAllocation, getHeight, getOffset, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, viewToModel
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, getViewIndexAtPosition, modelToView, setInsets, setParagraphInsets, setParent
append, breakView, createFragment, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModel
public WrappedPlainView(Element elem)
elem
- the element underlying the viewpublic WrappedPlainView(Element elem, boolean wordWrap)
elem
- the element underlying the viewwordWrap
- should lines be wrapped on word boundaries?protected int getTabSize()
@Deprecated(since="9") protected void drawLine(int p0, int p1, Graphics g, int x, int y)
drawLine(int, int, Graphics2D, float, float)
drawUnselectedText
and drawSelectedText
so that the way selected and unselected text are rendered can be customized.p0
- the starting document location to use >= 0p1
- the ending document location to use >= p1g
- the graphics contextx
- the starting X position >= 0y
- the starting Y position >= 0protected void drawLine(int p0, int p1, Graphics2D g, float x, float y)
drawUnselectedText
and drawSelectedText
so that the way selected and unselected text are rendered can be customized.p0
- the starting document location to use >= 0p1
- the ending document location to use >= p1g
- the graphics contextx
- the starting X position >= 0y
- the starting Y position >= 0@Deprecated(since="9") protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException
g
- the graphics contextx
- the starting X coordinate >= 0y
- the starting Y coordinate >= 0p0
- the beginning position in the model >= 0p1
- the ending position in the model >= p0BadLocationException
- if the range is invalidprotected float drawUnselectedText(Graphics2D g, float x, float y, int p0, int p1) throws BadLocationException
g
- the graphics contextx
- the starting X coordinate >= 0y
- the starting Y coordinate >= 0p0
- the beginning position in the model >= 0p1
- the ending position in the model >= p0BadLocationException
- if the range is invalid@Deprecated(since="9") protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException
g
- the graphics contextx
- the starting X coordinate >= 0y
- the starting Y coordinate >= 0p0
- the beginning position in the model >= 0p1
- the ending position in the model >= p0BadLocationException
- if the range is invalidprotected float drawSelectedText(Graphics2D g, float x, float y, int p0, int p1) throws BadLocationException
g
- the graphics contextx
- the starting X coordinate >= 0y
- the starting Y coordinate >= 0p0
- the beginning position in the model >= 0p1
- the ending position in the model >= p0BadLocationException
- if the range is invalidprotected final Segment getLineBuffer()
protected int calculateBreakPosition(int p0, int p1)
p0
- the starting document locationp1
- the ending document location to useprotected void loadChildren(ViewFactory f)
setParent
method. Subclasses can reimplement this to initialize their child views in a different manner. The default implementation creates a child view for each child element.loadChildren
in class CompositeView
f
- the view factorypublic float nextTabStop(float x, int tabOffset)
nextTabStop
in interface TabExpander
x
- the current position >= 0tabOffset
- the position within the text stream that the tab occurred at >= 0.public void paint(Graphics g, Shape a)
public void setSize(float width, float height)
public float getPreferredSpan(int axis)
getPreferredSpan
in class BoxView
axis
- may be either View.X_AXIS or View.Y_AXISpublic float getMinimumSpan(int axis)
getMinimumSpan
in class BoxView
axis
- may be either View.X_AXIS or View.Y_AXISpublic float getMaximumSpan(int axis)
getMaximumSpan
in class BoxView
axis
- may be either View.X_AXIS or View.Y_AXISpublic void insertUpdate(DocumentEvent e, Shape a, ViewFactory f)
insertUpdate
in class View
e
- the change information from the associated documenta
- the current allocation of the viewf
- the factory to use to rebuild if the view has childrenpublic void removeUpdate(DocumentEvent e, Shape a, ViewFactory f)
removeUpdate
in class View
e
- the change information from the associated documenta
- the current allocation of the viewf
- the factory to use to rebuild if the view has childrenpublic void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
changedUpdate
in class View
e
- the change information from the associated documenta
- the current allocation of the viewf
- the factory to use to rebuild if the view has children
© 1993, 2023, 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/21/docs/api/java.desktop/javax/swing/text/WrappedPlainView.html
drawLine(int, int, Graphics2D, float, float)