public class Label
extends ej.mwt.Widget
This example shows a simple label:
Label label = new Label("Hello World");
This example shows a styled label:
Label label = new Label("Hello World");
CascadingStylesheet stylesheet = new CascadingStylesheet();
desktop.setStylesheet(stylesheet);
EditableStyle labelStyle = stylesheet.getSelectorStyle(new TypeSelector(Label.class));
labelStyle.setColor(Colors.NAVY);
labelStyle.setBackground(new RectangularBackground(Colors.CYAN));
labelStyle.setFont(Font.getFont("/fonts/source_sans_pro_24.ejf"));

| Constructor and Description |
|---|
Label()
Creates a label with an empty text.
|
Label(java.lang.String text)
Creates a label with the given text to display.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
computeContentOptimalSize(ej.mwt.util.Size size) |
java.lang.String |
getText()
Gets the text displayed on this label.
|
protected void |
renderContent(ej.microui.display.GraphicsContext g,
int contentWidth,
int contentHeight) |
void |
setText(java.lang.String text)
Sets the text to display on this label.
|
addClassSelector, contains, containsWidget, getAbsoluteX, getAbsoluteY, getContentBounds, getDesktop, getHeight, getParent, getStyle, getWidgetAt, getWidth, getX, getY, handleEvent, hasClassSelector, isAttached, isEnabled, isInState, isShown, isTransparent, onAttached, onDetached, onHidden, onLaidOut, onShown, removeAllClassSelectors, removeClassSelector, render, requestLayOut, requestRender, requestRender, setClassSelectors, setEnabled, setPosition, setStyle, updateStylepublic Label()
public Label(java.lang.String text)
text - the text to display.public java.lang.String getText()
public void setText(java.lang.String text)
text - the text to display on this label.protected void renderContent(ej.microui.display.GraphicsContext g,
int contentWidth,
int contentHeight)
renderContent in class ej.mwt.Widgetprotected void computeContentOptimalSize(ej.mwt.util.Size size)
computeContentOptimalSize in class ej.mwt.Widget