File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes GUI problem for a really beginner...error?! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "GUI problem for a really beginner...error?!" Watch "GUI problem for a really beginner...error?!" New topic
Author

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

Nadine Ernest
Greenhorn

Joined: Dec 10, 2008
Posts: 27
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!


What Doesn't Kill You, Makes You Stronger!
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Have you forgotten




[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
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");
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GUI problem for a really beginner...error?!
 
Similar Threads
How to show the label with mnemonic key in a scrollPane?
Need Guru's help!!
Exception in thread "main"
JScrollpane problem
How to add a component to a Jcheckbox