Class TextSegment
- java.lang.Object
-
- com.realtime.crossfire.jxclient.gui.log.AbstractSegment
-
- com.realtime.crossfire.jxclient.gui.log.TextSegment
-
- All Implemented Interfaces:
Segment
public class TextSegment extends AbstractSegment
One segment of aLinewhich should be displayed without changing attributes.
-
-
Constructor Summary
Constructors Constructor Description TextSegment(@NotNull java.lang.String text, boolean bold, boolean italic, boolean underline, @NotNull FontID font, @Nullable java.awt.Color color)Creates a new segment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddraw(@NotNull java.awt.Graphics g, int y, @NotNull Fonts fonts)Draws this segment to aGraphicsinstance.@NotNull java.awt.geom.RectangularShapegetSize(@NotNull Fonts fonts, @NotNull java.awt.font.FontRenderContext context)Returns the size of this segment in pixels.@NotNull java.lang.StringgetText()Returns the text to display.booleanmatches(boolean bold, boolean italic, boolean underline, @NotNull FontID font, @Nullable java.awt.Color color)Returns whether this segment matches the given attributes.@NotNull java.lang.StringtoString()voidupdateAttributes(@NotNull Fonts fonts, @NotNull java.awt.font.FontRenderContext context)Updates the cached attributes of this segment.
-
-
-
Constructor Detail
-
TextSegment
public TextSegment(@NotNull @NotNull java.lang.String text, boolean bold, boolean italic, boolean underline, @NotNull @NotNull FontID font, @Nullable @Nullable java.awt.Color color)Creates a new segment.- Parameters:
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;nullmeans "default color"
-
-
Method Detail
-
getText
@NotNull public @NotNull java.lang.String getText()
Returns the text to display.- Returns:
- the text to display
-
draw
public void draw(@NotNull @NotNull java.awt.Graphics g, int y, @NotNull @NotNull Fonts fonts)Description copied from interface:SegmentDraws this segment to aGraphicsinstance.- Parameters:
g- the graphics to draw toy- the y-coordinate to draw tofonts- the fonts to use
-
updateAttributes
public void updateAttributes(@NotNull @NotNull Fonts fonts, @NotNull @NotNull java.awt.font.FontRenderContext context)Description copied from interface:SegmentUpdates the cached attributes of this segment.- Parameters:
fonts- the fonts instance to usecontext- the font render context to use
-
getSize
@NotNull public @NotNull java.awt.geom.RectangularShape getSize(@NotNull @NotNull Fonts fonts, @NotNull @NotNull java.awt.font.FontRenderContext context)Description copied from interface:SegmentReturns the size of this segment in pixels.- Parameters:
fonts- the fonts instance to usecontext- the font render context to use- Returns:
- the size
-
matches
public boolean matches(boolean bold, boolean italic, boolean underline, @NotNull @NotNull FontID font, @Nullable @Nullable java.awt.Color color)Returns whether this segment matches the given attributes.- Parameters:
bold- the bold attributeitalic- the italic attributeunderline- the underline attributefont- the font attributecolor- the color attribute- Returns:
- whether all attributes do match
-
toString
@NotNull public @NotNull java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-