To avoid blocking EDT, your data lookup should be done in the background thread. I would use SwingWorker to find and load values, as this makes it possible to use the background stream with other goodies that make it very convenient for Swing. I would enable the JComboBox enabled false property until all values ββare loaded, and then enable it through setEnabled(true) . You will find out that SwingWorker is executed either using the done() method (by overriding), or by adding a PropertyChangeListener to SwingWorker and notifying it when its status is SwingWorker.StateValue.DONE .
One way to find out that the process is complete is that they will see when the combo box has been re-enabled. If you need a more obvious indicator, you can display a JProgressBar or ProgressMonitor. This may appear in the dialog box if you want to leave the appearance of the graphical interface practically unchanged.
source share