A photo is worth a thousand words:
From the main window of the program, if you click the "Register user" button, the main window closes with dispose();
and the Register user window opens, but what about the opposite?
How do I close the Register User Window and make the Main Window appear again ? I want to do that because in the Main Window I have more buttons for other windows with different functions, maybe the user would like to do more things, besides registering a user.
I hope you can help me, I have never done this in Java.
First, it doesn't matter if it's Eclipse or any other IDE, you're asking about Java.
Second, to solve what you ask for, you can make a Manager, to manage which windows you use, which is the most complicated option if you don't know how to go through flows quickly. For a simple solution, the easiest thing is that you reference the class that calls (the main window that you put), until the new window:
set
that sets the JFrame to open when you hit a buttondispose()
the new window's method or create a methodcerrar()
that does what you want and call it from the button that closes the new window.Come on, you have many possibilities, and more that I have not put, think about it and try the one you like the most and if you have any problem then ask another more specific question.
EDIT TO ADD SOLUTION 3:
Solution three would be like this:
Inside your Main Window code:
When the main one reopens, it will be as you left it.