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.
I can see that the code you posted calls the dispose() method on something. Must be a JFrame, I suppose. So it would help if you told us what happens.
Is there more than one frame visible when that method is called? Does one of them disappear? Is it the wrong one?
Or is there some other problem? (I notice that line 25 in that code could be deleted, since it doesn't do anything useful -- unless creating a new PageUsuario object has some side effects.)
posted 2 weeks ago
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.
Going by the other questions Cezar has posted, it is very likely that dispose() is called on the wrong JFrame reference.
Cezar, you've been advised multiple times not to extend JFrame. Why are you ignoring this advise? Why don't you use an instance field to hold the reference to the frame?
posted 1 week ago
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:
posted 1 week ago
Hi, I solved my problem.
This is where are my problem.
Then I changed this method to:
Thanks and best regards.
Ever since I found this suit I've felt strange new needs. And a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop