This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

command button not able to display need help  RSS feed

jawwad ahmed
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi gurus;
Well my project is stuck due the reason that sl45i emulator does not
show any command button when i use textfield with it.
Here is program which i am trying to solve my problem
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Test extends MIDlet implements CommandListener{
private Display display; // Reference to display object
private Form fmMain; // The main form
private Command cmInsert; // Command to insert items
private Command cmExit; // Command to exit
private DateField dfDate; // Display date
private TextField tfSize; // Product size
private TextField tfQuantity;// Product quantity
private int dateIndex; // Index of dfDate
public Test(){
display = Display.getDisplay(this);
// Create the date and populate with current date
// Define two textfields and two commands
tfSize = new TextField("Enter",null,15, TextField.NUMERIC);
cmInsert = new Command("Insert", Command.SCREEN, 2);
fmMain = new Form("Form Data...");

public void startApp(){
public void pauseApp(){
public void destroyApp(boolean unconditional) {
public void commandAction(Command c, Displayable s){
Please i need help.Will be very yhankful.
Jawwad Ahmed
Rishi Tyagi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is command button on the screen but will be shown to you when you will scroll down.
Actually according to my experience with sl45i when you load some screen like this (you program) then the focus is at your text field while your command is associated with the form so when you will scroll down or up the screen using down/up arrow navigation key on the emulator or on the real phone then focus will be transfered to the form and then your command will be shown to you.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!