• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to come back the previous screen

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
sudhakar ananth
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java doesn't have screens. You need to be more specific about what you're doing. Including a runnable example might help.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);
}
});
 
sudhakar ananth
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please explain again? I am not getting exactly
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr michael
i got the solution using JDialog as you said in my other question
and thank you very much ...
 
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
frame.setVisible()
and
frame.dispose()

are the only two things you need
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic