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 Application runs and closes automatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Application runs and closes automatically" Watch "Application runs and closes automatically" New topic
Author

Application runs and closes automatically

Abder-Rahman Ali
Ranch Hand

Joined: May 22, 2008
Posts: 138
I have this code which is a JFrame with a JPanel and three buttons.

When I run the program it just closes AUTOMATICALLY. Why is that?



Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

What you think is a constructor isn't. It's a method that has the same name as a constructor would. Instead you are calling the default constructor that is generated automatically. Remove the "void" and see what happens.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Abder-Rahman Ali
Ranch Hand

Joined: May 22, 2008
Posts: 138
Thanks Rob, you are absolutely right.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Application runs and closes automatically
 
Similar Threads
Problems Resizing TextArea
Problems using JTabbedPane In a GUI application
GUI interaction
Press a button and draw a shape
Java Programming Help (conversions)