• 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

GUI problem for a really beginner...error?!

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, i just wrote this code and it compiles but it just doesnt give me anything....when i click the run button on Jcreator it tells me

java.lang.NoSuchMethodError: main
Exception in thread "main"
Process completed.



and this is my code:





What is the problem???!!!
why it doesnt run?!?!!

thanks a lot!
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you forgotten



 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, she has forgotten it. I got it to work, but I am not sure I want code telling me I am called Nadine It runs, but won't appear and won't close. You need code to make it visible (setVisible) and to set its default close operation. You can find more about that in the JFrame class. The strange contents of the main method are explained here. I know your lecturer won't believe you, but that is the correct way to start off a Swing app.

As I told you earlier, the getContentPane() calls are all unnecessary. Just write add() or setLayout(). You don't need to set BorderLayout on a JFrame; it defaults to BorderLayout. You can forget about setTitle if you pass the title to the constructor: super("Nadine's Frame");
 
reply
    Bookmark Topic Watch Topic
  • New Topic