Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Question of using the ProgressMonitor  RSS feed

Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making a swing product which use the JInternalFrame.
After the user open a file through the FileChooser, an JInternalFrame is opened. The process of opening the JInternalFrame needs more than 30 seconds, so I use the ProgressMonitor to represent the progress. So I make use of the files of ProgressMonitor, SwingWorker, and LongTask
from the
However, I have some questions about the use of these files:
1) I don't know where I should put the code of the time-consuming task (opening of the file) to those class I got.
I now put it in the class ActualTask in the LongTask file -
class ActualTask {
ActualTask () {
myFrame.openFile(); // the method of the file opening
while (current < lengthOfTask) {<br /> try {<br /> Thread.sleep(1000); <br /> current += Math.random() * 100; <br /> if (current > lengthOfTask) {
current = lengthOfTask;
statMessage = "Completed " + current + " out of " + lengthOfTask +
} catch (InterruptedException e) {}
actually, I found that it works, however, the progress dialog box does not appear until the JInternalFrame appears. That means the box
appears after the method.
Then where I should put the method of openFile() to.
[PS: the method openFile() does many things beside opening the file]
2) How can I determine the duration of the method? Should I estimate it?
Many Thanks!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!