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);
}
★★★Top Online Courses From ProgrammingKnowledge ★★★
Python Programming Course ➡️ ⚫️…
Thnk you so so much thnka man
Some smart people have a tendency to over complicate things Ahmed.
Thank you! You solved my error!
Pls stop being annoying my big brain cannot follow ur methodolgical proceedings with the Java Graphical User Interface code so pls halp and extand my mind
This video just helped me take a MAJOR step in getting my Computer Science degree. Thank to so much, bro! JUST what I needed.
verty esay methode tankes
very helpful
thanks a lot….
Mine is saying, cannot fins symbol, and it is pointing to the Toolkit.getDefaultToolkit line. Any ideas?
Thanks mate.
but Employeeid name surname age????? this form ??
at Login.java (or whatever you named it):
if(rs.next()){
JOptionPane.showMessageDialog(null, "Username and Password is correct");
rs.close();
pst.close();
patient_info s = new patient_info();
s.setVisible(true);
this.dispose(); //use this line of code which makes this entire video pointless
}
or just add "dispose();" before opening another frame.
very helpful, every word of you was clear and every step is slow and clear that we can follow step by step
may ALLAH bless you
Helpful (:
Thank you man
simply use this.dispose() on the method of the button.
You don't have to write this much code.
Helpful tutorials
use f.hide(); inside the action of the login
is there another method to close only a frame because your method is too long :V
I did the public void close exactly like the video:
public void close(){
WindowEvent winClosingEvent = new WindowEvent(this,WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(WinClosingEvent);
}
But it says it can't find symbol: class WindowEvent
Can someone please explain why?
I think better and easier would be:
public void close() {
this.setVisible(false);
this.dispose();
}
it closes out both windows