java.lang.Object com.realtime.crossfire.jxclient.gui.log.Line
public class Line
Manages the contents of one text line. A text line consists of a sequence of
Segment
s.
Field Summary | |
---|---|
private int |
height
The total height of this line. |
private java.util.List<Segment> |
segments
The segments this line consists of. |
Constructor Summary | |
---|---|
Line()
|
Method Summary | |
---|---|
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()
Return the height of this line. |
Segment |
getLastSegment()
Returns the last segment. |
java.util.Iterator<Segment> |
iterator()
|
void |
removeLastSegment()
Remove the last segment. |
void |
setHeight(int height)
Return the height of this line. |
void |
updateAttributes(int begin,
int end,
int y,
Fonts fonts,
java.awt.font.FontRenderContext context)
Update the cached attributes of some Segment s. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int height
-1
if unknown.
@NotNull private final java.util.List<Segment> segments
Constructor Detail |
---|
public Line()
Method Detail |
---|
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 height.public void updateAttributes(int begin, int end, int y, @NotNull Fonts fonts, @NotNull java.awt.font.FontRenderContext context)
Segment
s.
begin
- The index of the first segment to update.end
- The index of the first segment not to update.y
- The top border of the line's bounding box.fonts
- the fonts instance to usecontext
- the font render context to use