0

Is it possible to add Form to Tabs Class in LWUIT ?? As per the API tabs contain method to add only component. If yes please provide a sample code how to add it..

Will it be like - new Tabs.addTab("Title", form.show()) or how it is ??

user1635256
  • 111
  • 1
  • 11

2 Answers2

1

You need to use a container for the entries, you can add your form to a tabPane and than add the tabPane to another form(this form is a container for the entries). do like this:

Tabs tabPane = new Tabs(); 
Form frm_Obj = new Form("Show this form");
Form frm1 = new Form("Add this form to tabPane");

tabPane.addTab("My Form",frm1);

frm_Obj.addComponent(tabPane);
frm_Obj.show();
  • Hi, Thanks for it. Where is the show() method of frm1 called ??Unless i call show() its not seen.. If i add as tabPane.addTab("My Form",frm1.show()); it is compile time error. – user1635256 Aug 30 '13 at 17:13
  • you don't need call frm1.show(). when you switch between tabs frm1 will be show in that tab is content it. – Zabihullah Alipour Aug 30 '13 at 18:47
  • My frm1 is a separate java file which is Customised Form which extends Form but calling my customised form (new CustomisedForm()) is not working... – user1635256 Aug 31 '13 at 17:08
  • It does not matter, it should work. Did you test your CustomisedForm(in other project or etc)? In other projects it is working properly? if it works, put your code(where you customized). – Zabihullah Alipour Aug 31 '13 at 19:10
  • My customised Form is working well. I called in MIDLET as new CustomisedForm.show(); and it is working. If i place only new CustomisedForm it is not working. – user1635256 Sep 01 '13 at 16:22
  • This is the Exception i am getting when i directly call the instance of my Customised Form while adding it to a tab : Java.lang.IllegalArguementException: A Form cannot be added to a Container at com.sun.lwuit.Container.insertComponentAt: void insertComponentAt(int,com.sun.lwuit.Component) (Container.java :268) – user1635256 Sep 02 '13 at 08:05
0

Take a look on these posts. You can find here how to create tabs using Form. The Form class is a Componenttoo.

StackOverflow tab answer

Nokia developer tabs answer

Community
  • 1
  • 1
Mun0n
  • 4,438
  • 4
  • 28
  • 46