Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Use of ImageObserver ?  RSS feed

 
Ganesan Ramakrishnan
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the use of ImageObserver?



how here "this" pointing to ImageObserver Object?

Regards
Ganesan
 
Campbell Ritchie
Sheriff
Posts: 53779
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most Components implement the ImageObserver interface, so that is what "this" refers to.

Probably better on the Swing forum . . . moving.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the drawImage javadocs:
This method returns immediately in all cases, even if the image area to be drawn has not yet been scaled, dithered, and converted for the current output device. If the current output representation is not yet complete then drawImage returns false. As more of the image becomes available, the process that loads the image notifies the specified image observer.

Image operations can be slow. As the paragraph says, you can't assume that the operation is complete just because the method call returned. If you intend to do something with the image that assumes that it is in fact complete, then you need to work with ImageObserver, and wait until it tells you that the operation is complete.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are curious about ImageObserver, you might also want to take a look at MediaTracker.
Here is an example which shows you how to put it to use.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!