Modifier and Type | Field and Description |
---|---|
static Color |
STOCK_BLUE_FOREGROUND
A magenta blue color (RGB(22,110,177), #166EB1,
HSV(206,88,69)) which looks good with light and dark themes.
|
Constructor and Description |
---|
TextIcon(String text,
Font font,
Color foreground,
Color background,
Component c)
Constructs an icon where the customary image is replaced
by a short, colorful, text.
|
Modifier and Type | Method and Description |
---|---|
Color |
getBackground()
Returns the color of the text background.
|
Color |
getDisabledBackground()
Returns the color of the text backgroundwhen the component
owning the icon is not enabled.
|
Color |
getDisabledForeground()
Returns the color used to draw the text when the component
owning the icon is not enabled.
|
Font |
getFont()
Returns the font of this icon.
|
Color |
getForeground()
Returns the color used to draw the text.
|
int |
getIconHeight() |
int |
getIconWidth() |
Dimension |
getMinSize()
Returns the minimum size for this icon.
|
int |
getPadding()
Returns the padding around the text.
|
String |
getText()
Returns the text of the icon.
|
void |
paintIcon(Component c,
Graphics g,
int x,
int y) |
void |
setBackground(Color color)
Specifies the color of the text background.
|
void |
setDisabledBackground(Color color)
Specifies the color of the text background when the component
owning the icon is not enabled.
|
void |
setDisabledForeground(Color color)
Specifies the color used to draw the text when the component
owning the icon is not enabled.
|
void |
setFont(Font font,
Component c)
Specifies the font of this icon.
|
void |
setForeground(Color color)
Specifies the color used to draw the text.
|
void |
setMinSize(Dimension minSize,
Component c)
Specifies a minimum size for this icon.
|
void |
setPadding(int padding,
Component c)
Specifies the padding around the text.
|
void |
setText(String text,
Component c)
Specifies the text of this icon.
|
public static final Color STOCK_BLUE_FOREGROUND
public TextIcon(String text, Font font, Color foreground, Color background, Component c)
text
- text of the icon. May be multi-line.font
- font used to draw the textforeground
- color of the text.
May be null
.background
- color of the background of the text.
May be null
.c
- component ``owning'' this iconpublic void setText(String text, Component c)
public String getText()
public Font getFont()
public void setPadding(int padding, Component c)
public int getPadding()
public void setForeground(Color color)
null
means: text is not drawn at all (and not:
text is used as a stencil when painting the background).public Color getForeground()
null
.public void setBackground(Color color)
null
means: transparent background.public Color getBackground()
null
.public void setDisabledForeground(Color color)
null
means: compute the color (e.g. foreground
converted to gray).
Ignored if foreground is null
.
public Color getDisabledForeground()
null
.public void setDisabledBackground(Color color)
null
means: compute the color (e.g. background
converted to gray).
Ignored if background is null
.
public Color getDisabledBackground()
null
.public void setMinSize(Dimension minSize, Component c)
public Dimension getMinSize()
null
.public int getIconWidth()
getIconWidth
in interface Icon
public int getIconHeight()
getIconHeight
in interface Icon