Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Vector;
- import net.rim.device.api.system.Display;
- import net.rim.device.api.ui.Graphics;
- import net.rim.device.api.ui.component.ListField;
- import net.rim.device.api.ui.component.ListFieldCallback;
- import net.rim.device.api.ui.container.MainScreen;
- public class More extends MainScreen
- {
- private ListField _listField;
- private Vector _listElements;
- int current_index=0;
- BottomPanel bottomPanel;
- String userid,customerid,password,result;
- static String customer,user,pwd;
- ListCallback _callback;
- String name[]={"Home","Away","Settings","Help","About us","Log out"};
- public More(String customerid,String userid,String password,int current_index)
- {
- this.current_index=current_index;
- customer=customerid;
- user=userid;
- pwd=password;
- createGUI();
- }
- public void createGUI()
- {
- setTitle("MORE Screen");
- bottomPanel=new BottomPanel(current_index);
- _listElements = new Vector();
- initializeList();
- _callback = new ListCallback();
- _listField = new ListField()
- {
- protected boolean navigationClick(int status, int time)
- {
- StartUp.exceptionHandling("you selected index: "+name[_listField.getSelectedIndex()]);
- return super.navigationClick(status, time);
- }
- };
- _listField.setSize(_listElements.size());
- _listField.setCallback(_callback);
- add(_listField);
- setStatus(bottomPanel);
- }
- private void initializeList()
- {
- for(int i=0;i<name.length;i++)
- {
- _listElements.addElement(name[i]);
- }
- }
- // protected boolean navigationClick(int status, int time)
- // {
- // StartUp.exceptionHandling("you selected index: "+name[_listField.getSelectedIndex()]);
- // return super.navigationClick(status, time);
- // }
- //
- private class ListCallback implements ListFieldCallback
- {
- public void drawListRow(ListField list, Graphics g, int index, int y, int w)
- {
- String text = (String)_listElements.elementAt(index);
- g.drawText(text, 0, y, 0, w);
- }
- public Object get(ListField list, int index)
- {
- return _listElements.elementAt(index);
- }
- public int indexOfList(ListField list, String prefix, int string)
- {
- return _listElements.indexOf(prefix, string);
- }
- public int getPreferredWidth(ListField list)
- {
- return Display.getWidth();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement