File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display a new frame by hiding the existing frame

 
Karthick Hbk
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

I don't know how to achieve this using swings.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic