Close instance already created, Java - Eclipse

0

Good to you I am making an aplicaicon with several JFrames and in one of them there is a confirmation window, then suppose the following thing; I have: JF1. JF2. JD1.

Instance JF2 from a button belonging to JF1 and from there instancio JD1 and I want that at the push of a button, JD1 and JF are closed and reopened JF1 .

The problem here is that JF2 was installed in JF1 and I do not know how to close it from JD1

    
asked by Bruno Acosta 22.09.2018 в 07:42
source

2 answers

0

You should use the setVisible(boolean) instance method that each JFrame contains. That is, in the button's events method (which would close JF1 and JD1 ) you should set with setVisible(boolean) what windows to show and which ones not.

    
answered by 11.11.2018 в 05:15
-2

The JF2 that is static . in JF1 you would call it JF2.setVisible (true), and in JD1 JF2.setVisible (false) or JF2.dispose ();

    
answered by 11.11.2018 в 05:46