waba.ui
Class Label

java.lang.Object
  |
  +--waba.ui.Control
        |
        +--waba.ui.Label

public class Label
extends Control

Label is a text label control. It supports multiline, but you need to separate the text with |.

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.
 
Fields inherited from class waba.ui.Control
BOTTOM, CENTER, controlCount, enabled, FILL, fm, font, height, LEFT, name, next, parent, PREFERRED, prev, RIGHT, TOP, width, x, y
 
Constructor Summary
Label(java.lang.String text)
          Creates a label displaying the given text with left alignment. supports inverted text, multiple lines and is scrollable
Label(java.lang.String text, int align)
          Creates a label displaying the given text with the given alignment.
 
Method Summary
 int getPreferredHeight()
          returns the preffered width of this control. added by guich
 int getPreferredWidth()
          returns the preffered width of this control. added by guich
 java.lang.String getText()
          Gets the text that is displayed in the label.
protected  void onBoundsChanged()
          called after an setRect. added by guich
 void onPaint(Graphics g)
          Called by the system to draw the button.
static java.lang.String[] parseText(java.lang.String text, char delim)
          returns the parsed text
 boolean scroll(boolean down)
          scroll one page. returns true if success, false if no scroll possible
 void setInvert(boolean on)
          if invert is true, the background is filled with black and the letters are drawn white
 void setText(java.lang.String text)
          Sets the text that is displayed in the label.
 java.lang.String toString()
          Returns the string representation of the object.
 
Methods inherited from class waba.ui.Control
addTimer, contains, createGraphics, getAbsoluteRect, getFontMetrics, getNext, getParent, getRect, isEnabled, isVisible, onEvent, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, setEnabled, setFont, setRect, setRect, setVisible
 
Methods inherited from class java.lang.Object
hashCode
 

Field Detail

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.
Constructor Detail

Label

public Label(java.lang.String text)
Creates a label displaying the given text with left alignment. supports inverted text, multiple lines and is scrollable

Label

public Label(java.lang.String text,
             int align)
Creates a label displaying the given text with the given alignment.
Parameters:
text - the text displayed
align - the alignment
See Also:
LEFT, RIGHT, CENTER
Method Detail

setInvert

public void setInvert(boolean on)
if invert is true, the background is filled with black and the letters are drawn white

setText

public void setText(java.lang.String text)
Sets the text that is displayed in the label.

getText

public java.lang.String getText()
Gets the text that is displayed in the label.

parseText

public static java.lang.String[] parseText(java.lang.String text,
                                           char delim)
returns the parsed text

getPreferredWidth

public int getPreferredWidth()
returns the preffered width of this control. added by guich
Overrides:
getPreferredWidth in class Control

getPreferredHeight

public int getPreferredHeight()
returns the preffered width of this control. added by guich
Overrides:
getPreferredHeight in class Control

onBoundsChanged

protected void onBoundsChanged()
Description copied from class: Control
called after an setRect. added by guich
Overrides:
onBoundsChanged in class Control

scroll

public boolean scroll(boolean down)
scroll one page. returns true if success, false if no scroll possible

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

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Returns the string representation of the object.
Overrides:
toString in class java.lang.Object