Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Something's wrong with my code

 
Lawrence Buensalida
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I keep receiving

cannot resolve symbol
symbol: Constructor Form ()
location: class javax.microedition.lcdui.Form;
{
^
1 error


here's my code...


import javax.microedition.lcdui.*;

public class NewGame extends Form implements CommandListener
{
private WordMasterMind midlet;
private Command exitCommand = new Command("Exit", Command.EXIT,1);
private Command okCommand = new Command("Ok", Command.SCREEN, 1);
private MainMenuScreen mainMenuScreen;
Display display;

public NewGame()
{
TextBox greetings = new TextBox("Greetings", "Good morning", 15, 0);
display.setCurrent(greetings);
}

public void commandAction(Command c, Displayable s)
{
if(c==exitCommand)
{
midlet.mainMenuScreenShow(null);
return;
}
}
}



can you please tell me what's wrong with my code and what I'm to do about it. Thank you very much.
 
Punit Raizada
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think the javax.microedition.lcdui.Form class has a no argument constructor.

The only constructors exposed are

Form(String title);
Form(String title, Item[] items);


Regards,
 
Lawrence Buensalida
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Punit, but, why's that? Why am I receiving that error?
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might not construction the object correctly..

Im not sure if this will work, but try to insert the following statement
as the first line in your NewGame constructor:

super("My new game");

and see what'll happen.

/Svend Rost
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic