I would like for the GUI/JFrame of my Java application to display meaningful loading messages as is commonplace. How is it possible or what is the most refined way of passing loading messages to the JFrame class from a Class which is only running one method - so there will be sub-steps within the method?
2 Answers
You can use SwingWorker for your background task and pass data through the process() method call, as described here: http://download.oracle.com/javase/6/docs/api/javax/swing/SwingWorker.html
Comments
By loading do you mean that your non-GUI class is performing background processing, and you would like to show that this is happening to the user? If so, two things come to mind:
- Create and display a splash screen, or
- Create and display a progress bar, determinate if possible.
1 Comment
Tito
This is what I mean yeah, specifically I'm wondering about writing messages at stages within a method. I understand how this will be displayed, just not how the message should be passed from within a method to another class.