TextIcon Class Reference

An icon containing a given text (similar to a label). More...

List of all members.

Public Member Functions

 TextIcon (String _text, Component c)
 Creates a new icon with text _text.

 TextIcon (String _text, Component c, Color col)
 Creates a new icon with text _text.

void setColor (Color col)
 Sets the icon's color.

Color getColor ()
 Returns the icon's color.

void setText (String _text)
 Sets the icon's label (text).

String getText ()
 Returns the icon's label.

void setFontRenderContext (FontRenderContext frc)
 Sets the icon's font render context.

void setFontRenderContext (Component c)
 Sets the icon's font render context to be that of component c.

FontRenderContext getFontRenderContext ()
 Return's the icon's font render context.

void paintIcon (Component c, Graphics g, int x, int y)
 Renders the icon.

int getIconWidth ()
 Returns the icon's width.

int getIconHeight ()
 Returns the icon's height.


Package Attributes

String text = null
boolean border = true
Font font = null
FontRenderContext fontRenderContext = null
Color color = Color.black
boolean initialized = false
int width = -1
int height = -1

Private Member Functions

void checkChange ()
 Checks whether changes in the icon's parameter may still be made.

void init ()
 Initialises the icon.


Detailed Description

An icon containing a given text (similar to a label).

Definition at line 8 of file TextIcon.java.


Constructor & Destructor Documentation

TextIcon String  _text,
Component  c
[inline]
 

Creates a new icon with text _text.

The font render context is taken from component c (e.g. the component in which the icon will later be inserted).

Parameters:
_text the icon's label.
c a component.

Definition at line 25 of file TextIcon.java.

References setFontRenderContext(), and setText().

TextIcon String  _text,
Component  c,
Color  col
[inline]
 

Creates a new icon with text _text.

The font render context is taken from component c (e.g. the component in which the icon will later be inserted). The color of the icon is col.

Parameters:
_text the icon's label.
c a component.
col the icon's color.

Definition at line 38 of file TextIcon.java.

References setColor(), setFontRenderContext(), and setText().


Member Function Documentation

void checkChange  )  [inline, private]
 

Checks whether changes in the icon's parameter may still be made.

Any changes which may affect the icon's size are not allowed after first displaying the icon.

Exceptions:
UnsupportedOperationException if the icon has already been initialised (e.g. displayed).

Definition at line 91 of file TextIcon.java.

References initialized.

Referenced by setFontRenderContext(), and setText().

Color getColor  )  [inline]
 

Returns the icon's color.

Returns:
the icon's color.

Definition at line 51 of file TextIcon.java.

References color.

FontRenderContext getFontRenderContext  )  [inline]
 

Return's the icon's font render context.

Returns:
the icon's font render context.

Definition at line 82 of file TextIcon.java.

References fontRenderContext.

int getIconHeight  )  [inline]
 

Returns the icon's height.

After this, no changes in the icon's parameters affecting the size of the icon may be made any more.

Returns:
the height

Definition at line 144 of file TextIcon.java.

References height, and init().

int getIconWidth  )  [inline]
 

Returns the icon's width.

After this, no changes in the icon's parameters affecting the size of the icon may be made any more.

Returns:
the width

Definition at line 135 of file TextIcon.java.

References init(), and width.

String getText  )  [inline]
 

Returns the icon's label.

Returns:
the icon's label.

Definition at line 63 of file TextIcon.java.

References text.

void init  )  [inline, private]
 

Initialises the icon.

After this, no changes in the icon's parameters affecting the size of the icon may be made any more.

Definition at line 100 of file TextIcon.java.

References font, fontRenderContext, height, initialized, text, and width.

Referenced by getIconHeight(), getIconWidth(), and paintIcon().

void paintIcon Component  c,
Graphics  g,
int  x,
int  y
[inline]
 

Renders the icon.

After this, no changes in the icon's parameters affecting the size of the icon may be made any more.

Definition at line 117 of file TextIcon.java.

References border, color, font, height, init(), paintIcon(), text, and width.

Referenced by paintIcon().

void setColor Color  col  )  [inline]
 

Sets the icon's color.

Parameters:
col the new color.

Definition at line 47 of file TextIcon.java.

References color, and setColor().

Referenced by setColor(), and TextIcon().

void setFontRenderContext Component  c  )  [inline]
 

Sets the icon's font render context to be that of component c.

You may not change the font render context after displaying the icon.

Parameters:
c the component to take the font render context from.

Definition at line 77 of file TextIcon.java.

void setFontRenderContext FontRenderContext  frc  )  [inline]
 

Sets the icon's font render context.

You may not change the font render context after displaying the icon.

Parameters:
frc the new font render context.

Definition at line 69 of file TextIcon.java.

References checkChange(), fontRenderContext, and setFontRenderContext().

Referenced by setFontRenderContext(), and TextIcon().

void setText String  _text  )  [inline]
 

Sets the icon's label (text).

You may not change the label after displaying the icon.

Parameters:
_text the new label.

Definition at line 57 of file TextIcon.java.

References checkChange(), setText(), and text.

Referenced by setText(), and TextIcon().


Member Data Documentation

boolean border = true [package]
 

Definition at line 10 of file TextIcon.java.

Referenced by paintIcon().

Color color = Color.black [package]
 

Definition at line 13 of file TextIcon.java.

Referenced by getColor(), paintIcon(), and setColor().

Font font = null [package]
 

Definition at line 11 of file TextIcon.java.

Referenced by init(), and paintIcon().

FontRenderContext fontRenderContext = null [package]
 

Definition at line 12 of file TextIcon.java.

Referenced by getFontRenderContext(), init(), and setFontRenderContext().

int height = -1 [package]
 

Definition at line 17 of file TextIcon.java.

Referenced by getIconHeight(), init(), and paintIcon().

boolean initialized = false [package]
 

Definition at line 15 of file TextIcon.java.

Referenced by checkChange(), and init().

String text = null [package]
 

Definition at line 9 of file TextIcon.java.

Referenced by getText(), init(), paintIcon(), and setText().

int width = -1 [package]
 

Definition at line 16 of file TextIcon.java.

Referenced by getIconWidth(), init(), and paintIcon().


The documentation for this class was generated from the following file:
Generated on Sun Aug 15 11:56:54 2004 for International Input by doxygen 1.3.7