Thursday, October 25, 2012

Code used in video "Java prog#8. How to close previous jframe on the opening of new jframe in netbeans"

HERE I AM PROVIDING THE downloadable CODE LINK OF  THE JAVA CODE I HAVE USED IN THE VIDEO  "JJava prog#8. How to close previous jframe on the opening of new jframe in netbeans"  OF MY YOUTUBE CHANNEL PROGRAMMINGKNOWLEDGE

Click Link to watch the video LINK

This code below is for the close() function





   public void close(){

 WindowEvent winClosingEvent = new WindowEvent(this,WindowEvent.WINDOW_CLOSING);
 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClosingEvent);

 }

after that you have to call the function using below code


rs.close();
      pst.close();
       close();
//Employee_info  is the frame name you want to open
        Employee_info s =new Employee_info();
       s.setVisible(true);

Other way of doing that is also

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


Java prog#8. How to close previous jframe on the opening of new jframe in netbeans





it's simple just follow the below code:
First import these two files below
import java.awt.event.*;
import java.awt.*;


then write the method for close

 public void close(){

 WindowEvent winClosingEvent = new WindowEvent(this,WindowEvent.WINDOW_CLOSING);
 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClosingEvent);

 }



Java prog#25.Exit Command Button jFrame in Java netbeans 




--------------------------------------------------------------------------------------------------------

Java: How do I close a JFrame while opening another one?
How to close a jframe without closing the main program
Close one JFrame without closing another?
passing data from one jframe to another
How to disable main JFrame when open new JFrame
Opening new JFrame replaces current window
NetBeans Forums - Opening new Jframe in existing window
iit Learn     java netbeans
java tutorial netbeans


How to close a Java Swing application from the code
swing - How do I close a java application from the code
java swing close window
How to close Java program or Swing Application with Example
Closing A Swing Application?
How to close this window? Swing

1 comment: