0

When I open 2 frames: frame1.setEnabled(false), frame2.setVisible(true). When I hit the button "X" then frame2 close and want to set the enable frame1 (true), then how?

uı6ʎɹnɯ ꞁəıuɐp
  • 3,431
  • 3
  • 40
  • 49
Tuan Anh
  • 1
  • 1
  • use a window listener and implement the `windowClosing` method: `@Override public void windowClosing(WindowEvent e) { }` – XtremeBaumer Feb 21 '17 at 07:25
  • `then how ?` how what ? How to close one and enable the other? How to link this to a button click ? Please be more specific about your problem. – AxelH Feb 21 '17 at 07:41
  • Use a `JDialog`, then you won't need to care – MadProgrammer Feb 21 '17 at 07:46
  • 1) See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) 2) Why use AWT? See [this answer](http://stackoverflow.com/questions/6255106/java-gui-listeners-without-awt/6255978#6255978) for many good reasons to abandon AWT components in favor of Swing. – Andrew Thompson Feb 22 '17 at 00:20
  • typos fixed, markdown set – uı6ʎɹnɯ ꞁəıuɐp Feb 24 '17 at 16:35

1 Answers1

0

just create event handler/listener, on event onClose(or similar) maybe useful https://docs.oracle.com/javase/7/docs/api/java/beans/EventHandler.html

Kula
  • 25
  • 6