I wish to display a progress bar during a lengthy file translation process. When I created a ProgressBar class to do this and tested it with a short test program, it seemed to work fine. But when I add my ProgressBar class to a package containing various other classes, put that package in a jar file, and then execute the class using the progress bar from a menu in my main program, the frame of the progress bar shows up with the appropriate caption but the JLabel, JProgressBar, and JButton are not displayed. I have gone over my code numerous times and checked that the ProgressBar class constructor is getting the proper arguments, but I can't find anything wrong. I am completely mystified by this.
Ok, thanks for the pointers. I now have the progress bar working ok. What I did was to create a new interface to ensure that the class performing the lengthy file processing process would provide all of the query functions required by the ProgressBar to update its display:
I then added these functions to my file processing class, along with run().
Then I modified my ProgressBar class so that the Trackable class was one of the arguments to the constructor. The ProgressBar could then create a new thread for the Trackable class and start it. (I didn't want the user to have to click a Start button to start the process, since he had already selected a menu item and selected a directory from a FileChooser.)
After the main program launches the ProgressBar, control is immediately returned to it and the user can perform other operations, which is what I want. But now I have to figure out how to determine when the file processing class has finished executing so I can check its status and display an appropriate message, e.g. "installation aborted by user", "installation aborted due to file I/O error", "installation completed successfully", or whatever.