Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Using MediaTracker to track Images on multiple Panels - help

 
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
 
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

 
Wanna see my flashlight? How about this tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic