I'm trying to make a simple program with Java, Swing, that shows you a Window and by clicking the button "Start" it should show you a new panel with a login interface (enter username, password, login).
I've read a question asked here that says that it's better to use only one JFrame
and it makes sense because I don't want to start a new window between clicking "start" button and going to the login interface. But, how should I do this? I've created two JPanel
containers named loginPanel
and startPanel
, but I don't know how to set visible loginPanel
when the application runs, and then by clicking a button (in startPanel
) set visible loginPanel
(and obviously stop showing startPanel
).
I'm using the graphical Swing interface that comes with NetBeans (because the IDE have greyed the zone to edit the code by yourself, IDK why).
Could anyone give me a example of what I'd like to do?