File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Using MediaTracker to track Images on multiple Panels - help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Using MediaTracker to track Images on multiple Panels - help" Watch "Using MediaTracker to track Images on multiple Panels - help" New topic
Author

Using MediaTracker to track Images on multiple Panels - help

Bill Pearce
Ranch Hand

Joined: Sep 19, 2000
Posts: 53
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

Joined: Jan 09, 2001
Posts: 1492
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

Joined: Sep 19, 2000
Posts: 53
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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using MediaTracker to track Images on multiple Panels - help
 
Similar Threads
applet servlet communication
loading images in swings
Repainting of applets
Where Do I place the Folder for Java Applet Images?
Servlet and Applet communication