aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how to come back the previous screen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to come back the previous screen" Watch "how to come back the previous screen" New topic
Author

how to come back the previous screen

sudhakar ananth
Ranch Hand

Joined: Feb 02, 2007
Posts: 68
Hello Friends,

i have two screens A and B ok..

when i press "logout" in A screen i will get B screen as a new pop up screen.

the problem is when we have to press "cancle" button in B screen it has to come to same A screen .

that means i have to destroy that B screen object completely...
and come to screen A..

The main Requirement is to come back to the old A Screen and i should have full fuctionality normal in Screen A and screen B should dissapear... completely.....

Screen B is in Different class....

Thank you very friends
bye...
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

If "screen B" is simply a confirmation screen ("are you sure you want to log out"), I'd use a modal dialog to prompt the user without leaving "screen A".
If "screen B" is a fully-featured screen, I'd use Card Layout to flip between the screens without destroying them.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
sudhakar ananth
Ranch Hand

Joined: Feb 02, 2007
Posts: 68
Thanks friend but

the thing is the screen B look like "it has as User text box and Password text box ,OK button ,CANCEL button & EXIT button so

The process is when he click to logout from Screen A then he goes to Screen B.
and If he thinks to go Back to Screen A then he clicks CANCEL so this time
This Screen should destroy and i have to go back to Screen A

so really dont which lay out we are using please help me out..
bye
Ricky Clarkson
Ranch Hand

Joined: Jul 27, 2006
Posts: 131
Java doesn't have screens. You need to be more specific about what you're doing. Including a runnable example might help.
Tapan Maru
Ranch Hand

Joined: May 08, 2006
Posts: 65
you can write following lines in your code:

setDefaultCloseOperation(HIDE_ON_CLOSE);

//and following action listener of cancel button

cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
setVisible(false);
}
});


Tapan Maru
tapanmaru@gmail.com
sudhakar ananth
Ranch Hand

Joined: Feb 02, 2007
Posts: 68
yes we did the code what you said but what happened
the particular screen got invinsible . but the control on the other screen never reached that is .

we can see the screen A but we can do any operation on it but as you said
screen B is invisible

is there any method or thing where i can get control over it after invisibility..
sudhakar ananth
Ranch Hand

Joined: Feb 02, 2007
Posts: 68
yes we did the same to the code as you said but what happened
the particular screen got invinsible , but the control on the other screen never reached,
that is we can see the screen A but we cannot do any operation on it but as you said screen B is invisible

is there any method or thing where i can get control over it after invisibility..
Tapan Maru
Ranch Hand

Joined: May 08, 2006
Posts: 65
Can you please explain again? I am not getting exactly
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
I'm a bit lost with the description too, but this may handle your problem

add an actionListener to frameA's logoutButton, and in actionPerformed(..)
[frameA].setVisible(false):
new FrameB([frameA]);//include code for visibility of FrameB, if required

now, in the code for FrameB:
1) include a reference parameter (to frameA) in the constructor
2) add a windowListener, and in windowClosing(..) frameA.setVisible(true);
sudhakar ananth
Ranch Hand

Joined: Feb 02, 2007
Posts: 68
Mr michael
i got the solution using JDialog as you said in my other question
and thank you very much ...
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
frame.setVisible()
and
frame.dispose()

are the only two things you need


You down with OOP? Yeah you know me!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to come back the previous screen