permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes Connecting two GUI windows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Connecting two GUI windows" Watch "Connecting two GUI windows" New topic
Author

Connecting two GUI windows

Preeti Yarla
Ranch Hand

Joined: Sep 08, 2007
Posts: 69
How should I connect two GUI windows?

Ex:
I have window1 (components added to panel1 and panel1 added to frame1) with fields for login id and pwd and a login-button. After I enter data and click the button I want to see window2 (components added to panel2 and panel2 added to frame2) which shows some other information. To get this behavior, till now I used to create a new window2() in action handling part of code for login-button. So I am creating a new frame for every window in the application. A friend said that for security reasons its not the proper way to do. And that you usually should only have one frame for the entire app. And only change the panel you add to the frame depending on what you want to display. Is that true? I believe her but want to hear more from ranchers!


Thanks!

I added this post to Java in General (beginner) but somewhow it showed up in Swing forum also !!
[ June 09, 2008: Message edited by: Preeti Yarla ]

SCJP
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Did she tell you what the right way is?


GenRocket - Experts at Building Test Data
Preeti Yarla
Ranch Hand

Joined: Sep 08, 2007
Posts: 69
Yes.

That you usually should only have one frame for the entire app and only change the panels you add to the frame depending on what you want to display
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Preeti Yarla:
Yes.

That you usually should only have one frame for the entire app and only change the panels you add to the frame depending on what you want to display


Well, I asked the wrong question. Sorry. What I meant was, why is that the right way? Did she actually tell you the security implications of your initial approach? Because I don't see any issues. Now, what I might do is open a JFrame and initially prompt the user for a login using a modal JDialog. That differs slightly than your original design but not much. What are the security issues exactly?
Preeti Yarla
Ranch Hand

Joined: Sep 08, 2007
Posts: 69
I am waiting to hear the 'why' part of that from her and posted this in the mean time.

Say I want to go to window3 from window2. What is the right way to do that. Put that window3 in a new frame?

[ June 09, 2008: Message edited by: Preeti Yarla ]
[ December 19, 2008: Message edited by: Preeti Yarla ]
 
GeeCON Prague 2014
 
subject: Connecting two GUI windows