waba.ui
Class Label
waba.lang.Object
|
+--waba.ui.Control
|
+--waba.ui.Label
- public class Label
- extends Control
Label is a text label control.
Here is an example showing a label being used:
public class MyProgram extends MainWindow
{
public void onStart()
{
Label label = new Label("Value:");
label.setRect(10, 10, 80, 30);
add(label);
}
Field Summary |
static int |
CENTER
Constant for center alignment. |
static int |
LEFT
Constant for left alignment. |
static int |
RIGHT
Constant for right alignment. |
Constructor Summary |
Label(String text)
Creates a label displaying the given text with left alignment. |
Label(String text,
int align)
Creates a label displaying the given text with the given alignment. |
Method Summary |
String |
getText()
Gets the text that is displayed in the label. |
void |
onPaint(Graphics g)
Called by the system to draw the button. |
void |
setText(String text)
Sets the text that is displayed in the label. |
Methods inherited from class waba.ui.Control |
addTimer,
contains,
createGraphics,
getFontMetrics,
getNext,
getParent,
getRect,
onEvent,
postEvent,
removeTimer,
repaint,
setRect |
LEFT
public static final int LEFT
- Constant for left alignment.
CENTER
public static final int CENTER
- Constant for center alignment.
RIGHT
public static final int RIGHT
- Constant for right alignment.
Label
public Label(String text)
- Creates a label displaying the given text with left alignment.
Label
public Label(String text,
int align)
- Creates a label displaying the given text with the given alignment.
- Parameters:
text
- the text displayedalign
- the alignment- See Also:
LEFT
,
RIGHT
,
CENTER
setText
public void setText(String text)
- Sets the text that is displayed in the label.
getText
public String getText()
- Gets the text that is displayed in the label.
onPaint
public void onPaint(Graphics g)
- Called by the system to draw the button.
- Overrides:
- onPaint in class Control
- Tags copied from class: Control
- Parameters:
g
- the graphics object for drawing- See Also:
Graphics