Modifier and Type | Field and Description |
---|---|
private int |
height
The total height of this line.
|
private java.util.List<Segment> |
segments
The segments this line consists of.
|
Constructor and Description |
---|
Line() |
Modifier and Type | Method and Description |
---|---|
void |
addSegment(java.lang.String text,
boolean bold,
boolean italic,
boolean underline,
FontID font,
java.awt.Color color)
Appends a
Segment to the end of the line. |
int |
getHeight()
Returns the height of this line.
|
Segment |
getLastSegment()
Returns the last segment.
|
java.util.Iterator<Segment> |
iterator() |
void |
removeLastSegment()
Removes the last segment.
|
void |
setHeight(int height)
Returns the height of this line.
|
void |
updateAttributes(int begin,
int end,
int y,
Fonts fonts,
java.awt.font.FontRenderContext context)
Updates the cached attributes of some
Segments . |
private int height
-1
if unknown.@NotNull private final java.util.List<Segment> segments
public void addSegment(@NotNull java.lang.String text, boolean bold, boolean italic, boolean underline, @NotNull FontID font, @Nullable java.awt.Color color)
Segment
to the end of the line.text
- the text to displaybold
- whether bold face is enableditalic
- whether italic face is enabledunderline
- whether underlining is enabledfont
- the font to usecolor
- the color to use; null
means "default color"public int getHeight()
-1
until setHeight(int)
was called.@Nullable public Segment getLastSegment()
null
if the line is empty@NotNull public java.util.Iterator<Segment> iterator()
iterator
in interface java.lang.Iterable<Segment>
public void removeLastSegment()
public void setHeight(int height)
height
- the heightpublic void updateAttributes(int begin, int end, int y, @NotNull Fonts fonts, @NotNull java.awt.font.FontRenderContext context)
Segments
.begin
- the index of the first segment to updateend
- the index of the first segment not to updatey
- the top border of the line's bounding boxfonts
- the fonts instance to usecontext
- the font render context to use