Hi, I have an JFrame for login, after make login the new JFrame class is loaded fine. The JFrame that is loaded have many JInternalFrame that work without problem. My problem is that I can't close the Login Jframe. How I close my JFrame Login?
Below my Login class.
Most likely, calling its dispose() method will do the trick.
Of course, you have to have a reference to that JFrame to call any of its methods. I don't know if you have that or not, there was far too much code for anybody to go through all of it and find out. So if the question still exists for you, I would suggest writing an SSCCE in which you remove all of the code which doesn't involve closing the other frame. That would be much easier to deal with.
Hi, the line 25 is to execute another JFrame to make other things like record new user in my db tables and so on, line 25 are ok. After execute line 25 both frame is visible my Login frame and the PageUsuario loaded by line 25 that is correct. What I want is to close the Login frame by method dispose in line 27.
Hi, sorry by delay. I don't understand the last contact. What is " instance field to hold the reference to the frame?". How define this. About your code example I get the Name and PassWord to locate in my DB table and get the column tipo, the column tipo show me what JFrame I must to open.
Your variable "fPageMed" is the instance variable you should be using. It sounds like you have already been told not to extend JFrame. Doing that just leads to confusion -- is your JFrame referred to as "this" or as "fPageMed"? So don't extend JFrame. Like so: