|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel Text
public class Text
The Text class draws a String to the screen. It can show or hide the text, as well as an underline. Other options include changing the letter or underline color, and determining if the underline or text is visible or not. Although intended to be used for single letters, the Text class can be used to draw any length text to the screen. Note that showing/hiding the text and underline are independent. In other words, it is possible to display the text without the underline showing, display the underline without the text showing, show both, or show neither.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.BaselineResizeBehavior |
Field Summary | |
---|---|
static int |
SPACE
|
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Text(String t)
Initializes the text, sets the font, and sets the dimensions for this panel. |
Method Summary | |
---|---|
Color |
getLetterColor()
Returns the Color object used to determine
the display color of the text. |
String |
getText()
Returns the text string displayed by this text panel when shown. |
Color |
getUnderlineColor()
Returns the Color object used to determine
the display color of the underline. |
void |
hideText()
Causes the text to be hidden the next time paintComponent(Graphics) is called. |
void |
hideUnderline()
Causes the underline to be hidden the next time paintComponent(Graphics) is called. |
boolean |
isTextVisible()
Returns true if the text will be shown the next time paintComponent(Graphics) is called. |
boolean |
isUnderlined()
Returns true if the underline will be shown the next time paintComponent(Graphics) is called. |
boolean |
isWhiteSpace()
Returns true if the text is whitespace consisting of spaces, tabs, or returns. |
static void |
main(String[] args)
Main method for testing. |
void |
paintComponent(Graphics page)
Draws the text panel to the screen based on the field values. |
void |
setLetterColor(Color letterColor)
Sets the display color used when drawing the text. |
void |
setText(String t)
Sets the text to be displayed by this object. |
void |
setUnderlineColor(Color underlineColor)
Sets the display color used when drawing the underline. |
void |
showText()
Causes the text to be shown the next time paintComponent(Graphics) is called. |
void |
showUnderline()
Causes the underline to be shown the next time paintComponent(Graphics) is called. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SPACE
Constructor Detail |
---|
public Text(String t)
t
- the text string to be displayed by this
text panelMethod Detail |
---|
public void setText(String t)
t
- the text string to be displayed by this
text panelpublic String getText()
public boolean isWhiteSpace()
public void showText()
paintComponent(Graphics)
is called.
public void hideText()
paintComponent(Graphics)
is called.
public boolean isTextVisible()
paintComponent(Graphics)
is called. This
method returns false if the text will be invisible.
public void showUnderline()
paintComponent(Graphics)
is called.
public void hideUnderline()
paintComponent(Graphics)
is called.
public boolean isUnderlined()
paintComponent(Graphics)
is called.
This method returns false if the underline will be
invisible.
public Color getLetterColor()
Color
object used to determine
the display color of the text. Note the color is
independent of whether the text will be visible
or hidden.
public void setLetterColor(Color letterColor)
letterColor
- the Color
object to be
usedpublic Color getUnderlineColor()
Color
object used to determine
the display color of the underline. Note the color
is independent of whether the underline will be
visible or hidden.
public void setUnderlineColor(Color underlineColor)
underlineColor
- the Color
object to
be usedpublic void paintComponent(Graphics page)
paintComponent
in class JComponent
public static void main(String[] args)
args
- none necessary
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |