• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ImageObserver in servlets

 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a question on ImageObserver in servlets. Why is it sometimes we need to create the ImageObserver on the class level and other times as a local variable of doGet()? What is the difference?
Thanks!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The obvious difference is that a local variable should only exist for the duration of the request-response cycle, whereas an instance variable will hang around for the life of the servlet object.
I'm really curious as to what you are doing that needs an ImageObserver at all? When I need to load an Image into a servlet I use a MediaTracker.
Bill
 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, don't you have to have an ImageObserver as the parameter to a MediaTracker object?
Like
MediaTracker mt = new MediaTracker(frame); ? frame is an ImageObserver?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic