Tehmina Yaseen wrote:You need to check your application in the following ways:
Make sure your Excel files are placed in a correct path. Sometimes code stuck when DB unable to read the files/path appropriately.
The event actionlistener is executed in the GUI event processing thread (Swing is single threaded). You can't get any other event while in the callback.
check, look at where the method lags. In this case, it is where the user has to make a selection.
For more complex cases, e.g. if you need the UI to update without user intervention, you need to do your actual work in separate threads and use synchronization to coordinate the UI updates.
Dave Tolls wrote:All of that code in that ActionListener should be in it's own class, for handling the loading or whatever it is doing.
That way you can test that class in isolation, because at the moment how do you even know it works?
If that code needs data from the GUI then the Listener should be creating an object of a suitable class that encapsulates that data in a form that is usable by the new class, and passing that on. The processing probably ought to be on its own thread (look up SwingWorkers, or just go through the Concurrency tutorial Campbell linked to).
No. Its own class or its own λ. Simply providing a method is not sufficient.
Anthony Johnson wrote:. . . . Each ActionListener should have its own class or its own method.
Anthony Johnson wrote:
Just so I make sure I understand. Each ActionListener should have its own class or its own method.
Anthony Johnson wrote:Here is the updated code. No more freezing. Now my issue is that it is not writing to the file.