This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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 Elasticsearch in Action this week in the Big Data 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: 19911
    
  23

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://kickstarter.com/rocket-mass-heater
 
subject: Application runs and closes automatically