Method of passing meaningful messages between classes?
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 pas开发者_JAVA百科sing loading messages to the JFrame class from a Class which is only running one method - so there will be sub-steps within the method?
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
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.
精彩评论