- TabbedPane
Code
package hello; import com.sun.lwuit.CheckBox; import com.sun.lwuit.ComboBox; import com.sun.lwuit.Container; import com.sun.lwuit.Display; import com.sun.lwuit.Form; import com.sun.lwuit.Label; import com.sun.lwuit.TabbedPane; import com.sun.lwuit.TextArea; import com.sun.lwuit.TextField; import com.sun.lwuit.layouts.BoxLayout; import com.sun.lwuit.layouts.GridLayout; import javax.microedition.midlet.*; /** * @author Kanishka */ public class UIWidgets2 extends MIDlet { public void startApp() { Display.init(this); Container tab1=new Container(new BoxLayout(BoxLayout.Y_AXIS)); Container tab2=new Container(new GridLayout(2, 2)); Container tab3=new Container(); //creating widgets for tab1 Label lbl1=new Label("This is my Label 1"); Label lbl2=new Label("This is my Label 2"); Label lbl3=new Label("This is my Label 3"); tab1.addComponent(lbl1); tab1.addComponent(lbl2); tab1.addComponent(lbl3); //creating widgets for tab2 Label lblName=new Label("Name"); TextField txtName=new TextField(); Label lblAddr=new Label("Address"); TextArea txtAddr=new TextArea(); tab2.addComponent(lblName); tab2.addComponent(txtName); tab2.addComponent(lblAddr); tab2.addComponent(txtAddr); //creating widgets for tab3 //creating combo box String[] content={"Java","PHP","Python","C","C++","C#","VB","Prolog"}; ComboBox cmbx=new ComboBox(content); tab3.addComponent(cmbx); //creating the tabbed pane TabbedPane tabpane=new TabbedPane(TabbedPane.TOP); tabpane.addTab("Labels", tab1); tabpane.addTab("Text Boxes", tab2); tabpane.addTab("Combobox", tab3); //creating a form Form frm=new Form("Tabbed Pane Demo"); frm.addComponent(tabpane); frm.show(); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } }
0 comments:
Post a Comment