there is a JFrame A with a button on it, after click A the JFrame B will be open
how to close the JFrame B when I click a "close" button on B and then show the JFrame A?
Thanks in advance.
See the [url=http://java.sun.com/docs/books/tutorial/uiswing/components/frame.html]tutorial[/url], especially the section 'Responding to Window-Closing Events'.
For reshowning frame, it depends. Do you hide frame A when showing frame B?
If B has a reference to A, just call a.setVisible(true).
Otherwise have frameA add a WindowListener to B to reshown itself when B closes.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.