https://kotlinlang.org logo
o

Olav Hermansen

06/17/2020, 7:58 AM
From my initial view, I figured out that application was configured and ready to use. I try to open next window and close existing. But doing the closing in init might not be a good idea if the view does not exist yet? Any ideas on how I should go about?
Copy code
init {
  if(isConfigured) {
    MainApplicationView().openWindow()
    close()
  }
}
Edit: runLater on close did the trick, but gives the effect of window glitch. Could be I should check the config before any view is initiated.
s

sbyrne

06/17/2020, 12:53 PM
I handle this with a
java.util.concurrent.Phaser
. I call
register()
for each window I plan to open, and then
arriveAndDeregister()
on the
WINDOW_HIDDEN
event.
main
waits on
arriveAndAwaitAdvance()
.