Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes ImageObserver in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ImageObserver in servlets" Watch "ImageObserver in servlets" New topic
Author

ImageObserver in servlets

Bob Moranski
Ranch Hand

Joined: Nov 22, 2000
Posts: 177
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

Joined: Mar 22, 2000
Posts: 12760
    
    5
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

Joined: Nov 22, 2000
Posts: 177
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ImageObserver in servlets
 
Similar Threads
creating BufferedImage object in a servlet
drawImage(Image, int, int, ImageObserver)
Help me in calculating image data
Use of ImageObserver ?
drawImage to Panel