Hi, This is my first post in javaRanch, Hope I vl get my solution. Let me share the issue, What i had.
I am doing a project completely based on swing components. In that In the topleft corner of the frame, There will be a new, save and open buttons for their respective functions. If the user clicks the Save button after enter the inputs & If the same user clicks a new button means, It should create a new frame that contains a fresh application page that should not contain, What user entered before clicking new button. The challenging thing is that, When user clicks new button, The new frame should appear by hiding the existing frame.
It's not a good approach to show multiple JFrame instances in one application. Instead, you can as well use dialogs or internal frames (inside the main application frame). You should check this tutorial:
To make a window that is dependent on another window — disappearing when the other window is iconified, for example — use a dialog instead of frame.. To make a window that appears within another window, use an internal frame.
The quieter you are, the more you are able to hear.
Joined: Jun 09, 2003
> It should create a new frame that contains a fresh application page that should not contain, What user entered before clicking new button.
if the original application page is identical to the application page after clicking the new button,
all the new button has to do is to clear/reset all the input fields/comboBoxes etc.
if the aplication pages are different, perhaps a CardLayout might suit, but you'd still need to
clear a page if the new button is clicked more than once.