• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Something's wrong with my code

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Punit, but, why's that? Why am I receiving that error?
 
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic