Showing posts with label Jframe. Show all posts
Showing posts with label Jframe. Show all posts

Closing Jframe on Jbutton Click

Saturday, 24 May 2014

java logo

Not going to do too much bla bla..

Just open up Netbeans Ide

create new project—>java—> java desktop applcation

Switch  to design View Take a Jbutton from the right side of Ide Palette

Right Click Jbutton You will see

Events—>Action—>ActionPerformed

Click it you will be automatically Switched to Source View

You will see code like this

 1: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) 
 2: { 
 3: System.exit(0);//Closes Jframe with exit code '0' 
 4: }


 


Now Run and compile it press Jbutton It closes the jframe


 


Thanks

Paste Long Url