javax.swing.text
public class PlainView extends View implements TabExpander
| Field Summary | |
|---|---|
| protected FontMetrics | metrics |
| Constructor Summary | |
|---|---|
| PlainView(Element elem) | |
| Method Summary | |
|---|---|
| void | changedUpdate(DocumentEvent changes, Shape a, ViewFactory f)
This method is called when attributes were changed in the
Document in a location that this view is responsible for. |
| protected void | damageLineRange(int line0, int line1, Shape a, Component host)
Repaint the given line range. |
| protected void | drawLine(int lineIndex, Graphics g, int x, int y)
Draws a line of text. |
| protected int | drawSelectedText(Graphics g, int x, int y, int p0, int p1) |
| protected int | drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
Draws a chunk of unselected text.
|
| protected Segment | getLineBuffer()
Provides a {@link Segment} object, that can be used to fetch text from
the document.
|
| float | getPreferredSpan(int axis) |
| protected int | getTabSize()
Returns the tab size of a tab. |
| void | insertUpdate(DocumentEvent changes, Shape a, ViewFactory f)
This method is called when something is inserted into the Document
that this View is displaying.
|
| protected Rectangle | lineToRect(Shape a, int line) |
| Shape | modelToView(int position, Shape a, Position.Bias b) |
| float | nextTabStop(float x, int tabStop)
Returns the next tab stop position after a given reference position.
|
| void | paint(Graphics g, Shape s) |
| void | removeUpdate(DocumentEvent changes, Shape a, ViewFactory f)
This method is called when something is removed from the Document
that this View is displaying.
|
| protected void | updateDamage(DocumentEvent changes, Shape a, ViewFactory f)
Since insertUpdate and removeUpdate each deal with children
Elements being both added and removed, they both have to perform
the same checks. |
| protected void | updateMetrics() |
| 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.
|
Parameters: line0 the start of the range line1 the end of the range a the rendering region of the host host the Component that uses this View (used to call repaint on that Component)
Since: 1.4
Parameters: lineIndex the index of the line g the graphics to use for drawing the text x the X coordinate of the baseline y the Y coordinate of the baseline
Parameters: g the graphics to use for drawing the text x the X coordinate of the baseline y the Y coordinate of the baseline p0 the start position in the text model p1 the end position in the text model
Returns: the X location of the end of the range
Throws: BadLocationException if p0 or p1 are
invalid
UNKNOWN: {@link Segment} object, that can be used to fetch text from the document
Returns: the tab size.
Parameters: changes the DocumentEvent for the changes. a the allocation of the View f the ViewFactory used to rebuild
Since: 1.4
tabStop argument.
Parameters: x the current x position in pixels tabStop the position within the text stream that the tab occured at
Parameters: changes the DocumentEvent for the changes. a the allocation of the View f the ViewFactory used to rebuild
Parameters: changes the DocumentEvent for the changes to the Document. a the allocation of the View. f the ViewFactory to use for rebuilding.
Since: 1.4
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