0 Replies - 1392 Views - Last Post: 06 March 2012 - 03:09 PM

#1 TheStarterCoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-February 12

Midlet forms, radio buttons and textfields

Posted 06 March 2012 - 03:09 PM

hi, i am trying to make a midlet with three items in a form, it goes like this:
1. At the top of the screen i want it to have a textField where a person can enter their name
2. Below the text field i would like there to be 4 radio buttons
3. And finally i would like two textfields each on line below the radio buttons.

is this possible?...i can only seem to get either one or the other to work, my coding below is my starting point,
i am using sun java wireless toolkit: version 2.5.2

import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Commander extends MIDlet implements CommandListener
{
  private Form form;
  private Display display;
  private TextField name;
  private Command ok, exit;
  
  public Commander(){
  name = new TextField("Name:", "", 30, TextField.ANY); 
  ok = new Command("Ok", Command.OK, 2);
  exit = new Command("Exit", Command.EXIT, 1);
  }

  public void startApp(){
  display = Display.getDisplay(this);
  Form form = new Form("Work Status");
  form.append(name);
  form.addCommand(ok);
  form.addCommand(exit);
  form.setCommandListener(this);
  display.setCurrent(form);
  }

  public void pauseApp(){
  
  }

  public void destroyApp(boolean destroy){
  notifyDestroyed();
  }
  public void commandAction(Command c, Displayable d) {
  if(c == exit)
  {
  destroyApp(false);
  notifyDestroyed();
  } 
  }
}



Is This A Good Question/Topic? 0
  • +

Page 1 of 1