Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using MediaTracker to track Images on multiple Panels - help

 
Bill Pearce
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am writing an applet which includes several Panels placed on the Applet. I am facing some difficulty in formulating a method to track the loading of all the Images (on all the Panels), so that the main Applet does not start until all Images are available.
I can find no examples using anything like this. Has anyone tried to manage the loading of all the Images in a multi-Panel applet? Any ideas are appreciated as usual.
Bill
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,
Why don't you use MediaTracker. It takes a component so just use your main component (i.e., JFrame, JApplet, etc.) or any other common parent to all the panels.
Regards,
Manfred.
 
Bill Pearce
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Manfred,
Thanks, but I am using MediaTracker, but the problem I have seems to be the sequence in which I am trying to do things. I need to :
Initialize the Panels on the Applet (which use the Images).
Call paint() on the Applet to display the "Please wait..." message.
Load the Images using MediaTracker.
Display the LoginPanel.
The problem is that I am initializing the Panels in the Applet's init() method. Since the Panels need the Images to construct themselves, I can't construct the Panels before the Images load.
Since the init() method must complete before paint() is called, I can't get the please wait message to display before loading the images.

Has anyone seen (or created) a multi-panel applet and used MediaTracker to load all the Images used on all panels at once? Every example I have seen uses only the Applet itself as the panel where the Images are displayed.

Thanks
Bill

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic