-1

I have some problem with creating back button. Now in form there is list, I need create button which be on this form in the lower right corner, and when scrolling list, button remains in its place(the lower right corner). I was trying create container in for lower of the screen and do his invisible. But its not helped because list does not appear under container.

Dima
  • 1,189
  • 1
  • 13
  • 31

2 Answers2

1

You can try this...

import com.sun.lwuit.Command;
import com.sun.lwuit.Form;
import com.sun.lwuit.Display;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
public class FirstApp extends MIDlet implements ActionListener{

Form f;
Command exitCommand;
public FirstApp()
{
    //display form
   Display.init(this);
   f = new Form("myForm");
   f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}

public void commandAction(Command c, Displayable dis) 
{

}

protected void startApp() throws MIDletStateChangeException 
{   
   //add exit button
       Command exitCommand;
   exitCommand = new Command("EXIT")
   {
        public void actionPerformed(ActionEvent e) {
            notifyDestroyed();
       }
   };
  f.addCommand(exitCommand);
  f.setBackCommand(exitCommand);
}
Sam
  • 925
  • 1
  • 12
  • 28
0

You need to use in Object Command.

Command cmd = new Command(searchText) {
      public void actionPerformed(ActionEvent evt) {
           //TODO - implement back 
        }
    };

and than adding him to Form

f.addCommand(command);
neb1
  • 209
  • 1
  • 12
  • If I use command I get a full string with my button, but I need have only one button. How to make command line invisible? – Dima Jan 24 '13 at 08:30
  • If you work with Nokia you can't do it, because that soft keys is minimal 2 soft's key (despite one of them don't be active) – neb1 Jan 24 '13 at 08:59