Closing Jframe on Jbutton Click
Saturday, 24 May 2014Posted by
Amrishwa
0 Comments
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
Subscribe to:
Post Comments (Atom)