• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Application runs and closes automatically

 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Abder-Rahman Ali
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob, you are absolutely right.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic