hi everyone

i need your help, i ave a project where by i have to create a simple mortgage calculator. the problem is that i have to create a login frame where it will redirect me to the main frame which is the calculator.Could someone show me how to switch between the frames

This might be useful for you, read the answer -> Click Here

  • don't to create more that one JFrame, use JDialog with JFrame as parent, and/or with modality too

  • easiest of ways is usage of CardLayout with JPanels as Card, views

  • call JFrame.pack() after Card is switched (note works only in the case there is used LayoutManager, not NullLayout)

Normally I agree with mKorbel, but in this particular case (one-time logon screen -> the rest of the application) I don't. I'd use a dialog for the logon, then dispose() it and hand over the application's main window.

For the sake of variety, I will add that you can have both frames all the time, but switching their visibility using setVisible(); to true or false.