Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 |.

Note: this class does not do automatic parse of the text, because this is a slow operation. But, you can use a handy method to parse the text that you want to display: see the waba.applet.Handy.boundText method. You can call this method when creating your programs in the desktop and use the console output as parameter for the constructor.

Here is an example showing a label being used:

     public class MyProgram extends MainWindow
     {
     public void onStart()
      {
      add(new Label("Value:"), LEFT, TOP);
      }

Field Summary
`protected int` | `align`

Fields inherited from class waba.ui.Control
`AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, font, foreColor, foreDis, height, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2`

Constructor Summary
`Label(String text)` Creates a label displaying the given text with left alignment. supports inverted text, multiple lines and is scrollable
`Label(String text, int align)` Creates a label displaying the given text with the given alignment.

Method Summary
`boolean` | `canScroll(boolean down)` returns if the label can scroll in the given direction
`int` | `getPreferredHeight()` returns the preffered width of this control. added by guich
`int` | `getPreferredWidth()` returns the preffered width of this control. added by guich
`String` | `getText()` Gets the text that is displayed in the label.
`protected void` | `onBoundsChanged()` Called after an setRect.
`protected void` | `onFontChanged()` Called after a setFont
`void` | `onPaint(Graphics g)` Called by the system to draw the button.
`boolean` | `scroll(boolean down)` scroll one page. returns true if success, false if no scroll possible
`void` | `set3d(boolean on)` if 3d is true, draws the label with a 3d effect. turns off invert.
`void` | `setInvert(boolean on)` if invert is true, the back and fore color are swaped. turns off 3d.
`void` | `setText(String text)` Sets the text that is displayed in the label.

Methods inherited from class waba.ui.Control
`addTimer, contains, createGraphics, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getRect, getSize, isDisplayed, isEnabled, isVisible, onColorsChanged, onEvent, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setEnabled, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, toString, wait, wait`

Field Detail

### align

    protected int align

Constructor Detail

### Label

    public Label(String text)

  Creates a label displaying the given text with left alignment. supports inverted text, multiple lines and is scrollable

### Label

    public Label(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:
    `Control.LEFT`, `Control.RIGHT`, `Control.CENTER`

Method Detail

### set3d

    public void set3d(boolean on)

  if 3d is true, draws the label with a 3d effect. turns off invert.

### setInvert

    public void setInvert(boolean on)

  if invert is true, the back and fore color are swaped. turns off 3d.

### 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.

### 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

### onFontChanged

    protected void onFontChanged()

  Description copied from class: Control
  Called after a setFont
  Overrides:
    onFontChanged in class Control

### onBoundsChanged

    protected void onBoundsChanged()

  Description copied from class: Control
  Called after an setRect.
  Overrides:
    onBoundsChanged in class Control

### canScroll

    public boolean canScroll(boolean down)

  returns if the label can scroll in the given direction

### 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`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD