- java.lang.Object
-
- util.ui.TextAreaIcon
-
- All Implemented Interfaces:
javax.swing.Icon
public class TextAreaIcon extends java.lang.Object implements javax.swing.Icon
An icon that displays multiline text.- Author:
- Martin Oberhauser
-
-
Constructor Summary
Constructors Constructor Description TextAreaIcon(java.lang.String text, java.awt.Font font, int width)
Creates a TextAreaIcon with the specified text, font and width.TextAreaIcon(java.lang.String text, java.awt.Font font, int width, int lineSpace)
Creates a TextAreaIcon with the specified text, font and width.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIconHeight()
Returns the icon's height.int
getIconWidth()
Returns the icon's mWidth.int
getLineCount()
int
getMaximumLineCount()
Get the maximum LineCountboolean
isTextCut()
has the text in this icon been cut because it was longer than maxLines?void
paintIcon(java.awt.Component comp, java.awt.Graphics grp, int x, int y)
Draw the icon at the specified location.void
setMaximumLineCount(int maxLineCount)
Sets the maximum Linecountvoid
setText(java.io.Reader textReader)
Set the Text of this Iconvoid
setText(java.lang.String text)
Set the Text of this Icon
-
-
-
Constructor Detail
-
TextAreaIcon
public TextAreaIcon(java.lang.String text, java.awt.Font font, int width, int lineSpace)
Creates a TextAreaIcon with the specified text, font and width.- Parameters:
text
- The text.font
- The font.width
- The width.lineSpace
- The line space.
-
TextAreaIcon
public TextAreaIcon(java.lang.String text, java.awt.Font font, int width)
Creates a TextAreaIcon with the specified text, font and width.- Parameters:
text
- The text.font
- The font.width
- The width.
-
-
Method Detail
-
setMaximumLineCount
public void setMaximumLineCount(int maxLineCount)
Sets the maximum Linecount- Parameters:
maxLineCount
- Max Count of Lines
-
getMaximumLineCount
public int getMaximumLineCount()
Get the maximum LineCount- Returns:
- Maximum LineCount
-
setText
public void setText(java.lang.String text)
Set the Text of this Icon- Parameters:
text
- Text in this Icon
-
setText
public void setText(java.io.Reader textReader) throws java.io.IOException
Set the Text of this Icon- Parameters:
textReader
- Text in this Icon- Throws:
java.io.IOException
- Thrown if an IO operation went wrong.
-
getIconHeight
public int getIconHeight()
Returns the icon's height.- Specified by:
getIconHeight
in interfacejavax.swing.Icon
- Returns:
- an int specifying the fixed height of the icon.
-
getIconWidth
public int getIconWidth()
Returns the icon's mWidth.- Specified by:
getIconWidth
in interfacejavax.swing.Icon
- Returns:
- an int specifying the fixed mWidth of the icon.
-
getLineCount
public int getLineCount()
- Returns:
- The number of used lines.
-
paintIcon
public void paintIcon(java.awt.Component comp, java.awt.Graphics grp, int x, int y)
Draw the icon at the specified location. Icon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.- Specified by:
paintIcon
in interfacejavax.swing.Icon
-
isTextCut
public boolean isTextCut()
has the text in this icon been cut because it was longer than maxLines?- Returns:
true
if the text was cut- Since:
- 3.0
-
-