1
I have a desktop application on swing
, and in it, I have a single JFrame
which is always visible while the application is open. There are also some JDialogs
modals dependent on this Frame, which open from certain buttons in the JFrame
.
I’m testing a progress bar using SwingWorker
(another question asked and answered here), and I need to pass the Frame for this class to activate the progressBar
, but I need to get the Frame instance already opened in another different class.
In the Frame
, I have a public method called getInstance()
, that returns the window’s own instance, but to use it, I need to already have a Frame object created, but in this case, I cannot create another instance, I need to get the one that is already active.
From there, I wondered if maybe the EDT would allow, somehow, to recover the current open frame, even more because the classes where I need to make this call, were also initiated in the EDT, but I don’t know how it does it.
It is possible, from the Event-Dispatch-thread (EDT), retrieve this Frame already initialized and visible in the application? If yes, how to do this?