|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--waba.ui.Control | +--waba.ui.Label
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 | |
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 |
public int align
Constructor Detail |
public Label(String text)
public Label(String text, int align)
text
- the text displayedalign
- the alignmentControl.LEFT
,
Control.RIGHT
,
Control.CENTER
Method Detail |
public void set3d(boolean on)
public void setInvert(boolean on)
public void setText(String text)
public String getText()
public int getPreferredWidth()
public int getPreferredHeight()
protected void onFontChanged()
protected void onBoundsChanged()
public boolean canScroll(boolean down)
public boolean scroll(boolean down)
public void onPaint(Graphics g)
g
- the graphics object for drawingGraphics
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |