This is probably a stupid question, but after all, it's a beginner's forum
So, i' programming an application which allows to choose a text file (with a specific content) and transforms it into a XML File. I also want to display, after the file has been selected, a modal dialog box which shows the advancement of the process.
Here are parts of the relevant code of the main window:
So, when a file is chosen, i want to display an instance of my custom dialog box, here are parts of the code of this box :
When I run this code, i can choose a file, and when i click on the "open" button of the JFileChooser, my custom modal dialog box is displayed, but the JTextField remains empty, despite the line : dialog.setProgress("Beginning XML transformation process") that comes after dialog.setVisible(true) in the code of the main window. The code that follows is not executed either
If however, i modify my dialog box code slightly by removing the line setModal(true), it works perfectly.
So, i suppose that when a modal dialog box is created, the execution of code in the parent window is blocked until the modal dialog is closed and that it's not the case when the dialog box is not modal (is it so ?)
But i'd like to keep my dialog box modal, so my question is simple : Is there any way to do what i want and keep the dialog box modal (i've heard about threads, but i don't know if it's the right thing to use, and frankly, it seems a bit overwhelming)