Skip to content
Advertisement

how to configure joptionpane with no button to dispose()?

i would like to display a message while initialisation of data using a dialog.

But it does’t want to close and I can’t see what is wrong with this code :

JavaScript

Thank you

Advertisement

Answer

This…

JavaScript

is wrong. Once the dialog is made visible, it will wait till it’s closed before continuing the flow of execution, it’s one of the neat side effects of modal dialogs

I also suspect that you’re violating the single threaded nature of Swing.

See:

for more details

Runnable example…

This example shows a dialog, waits for 5 seconds (in the background) and then closes the window. A neat side effect of this is, the window can’t be closed by the user 😈

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement