I am working on my first forms app (using NetBeans). I don't like to mix GUI code with app code, so I have my main class, GUI class and core code class nicely seperated. When the user clicks a button on the GUI form it calls a method in the core code which returns a value that the GUI displays. So far, so good, but...
I have a method that processes a file and it takes a long time. I'd like that method to update the GUI as it's working so the user doesn't think the program is hung up. I'd like the user to see something like this in a jTextArea on the GUI:
Opening file xyz.csv.
Reading cross-correlated data points.
Calculating offset deviations.
Interpolating target temperatures.
Writing file xyz_clean.csv.
While all of this is going on how does the GUI get updated? Is it possible for the processing method in my core code to write directly to the jTextArea on the GUI?
I'm open to all suggestions and I'd love to know how an experienced Java programmer would keep the user informed. What is the best practice for situations like this?
Edited 4 Years Ago by WDrago