Nokia Mobile Application Development LWUIT Components and Syntax

LWUIT Components and their syntax:


Form:

To create a Form

Form f1=new Form("Music Player");

To add a component to form

f1,addComponent(new Label("Hai This is a lable"));

To add a command to form

f1,addCommand(new Command("back"));

To Display a form

f1,show();

Label:

To Create a Label

Label a=new Label("Hai i am a label");

To Change Alignment of Label

a.getStyle().setAlignment(Label.CENTER);

BUTTON:

To Create a Button

Button b= new Button("Button_Name to be displayed");

e.g

Button b=new Button("Calculate");

To Create action Listener for Button

b.addActionListener(new ActionListener() {
 public void actionPerformed(ActionEvent ae)
{
  <---------------Action to be Performed byButtton Event--------------->
}
});

RADIO BUTTON:

To Create a RadioButton

RadioButton rb =new RadioButton("I am Radio Button !");

SLIDER:

To create a Slider

Slider a=new Slider();
a,setInfinite(true);

TABS:

To create Tabs

Tabs t=new Tabs();

To add components to Tabs

t.addTab("Tab 1",new Form("Form_Title"));
t.addTab("Tab 2",new Label("I am a Label in Form 2"));

TEXT AREA:

To add components to TextArea

TextArea a=new TextArea("This is a TextArea Component");

To set Number of Rows and Columns

TextArea a=new TextArea("This is a TextArea with Component" ,20,4);

To Change Editable property of TextArea

a.setEditable(false);

a.setGrowByContent(true);

TextField:

To Create TextField

TextField a = new TextField(“This is a text field”);


This is a Courtesy help form digitalnativedev.