Differences between getImage and createImage and using Toolkit  
Author Message
Eitan M





PostPosted: 2006-7-27 4:34:00 Top

java-programmer, Differences between getImage and createImage and using Toolkit Hello,
What are the differences between getImage and createImage,
and what if I want using toolKit - (getImage and createImage are static,
and I didn't find a way to create an Image object from a function of
toolkit).

I need a sample code, please.

Thanks :)


 
Thomas Fritsch





PostPosted: 2006-7-27 4:12:00 Top

java-programmer >> Differences between getImage and createImage and using Toolkit "Eitan M" <email***@***.com> wrote:
> What are the differences between getImage and createImage,
See http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Toolkit.html
The difference is that, getImage involves image caching and createImage does
not.
Cited from the API doc of Toolkit#getImage(String):
"The underlying toolkit attempts to resolve multiple requests with the same
filename to the same returned Image."
Cited from the API doc of Toolkit#createImage(String):
"The returned Image is a new object which will not be shared with any other
caller of this method or its getImage variant."

> and what if I want using toolKit - (getImage and createImage are static,
> and I didn't find a way to create an Image object from a function of
> toolkit).
You mean, these methods are *not* static, don't you?
Click "Use" at the top of the API doc of Toolkit. You find a list of methods
that return a Toolkit.
>
> I need a sample code, please.

--
"TFritsch$t-online:de".replace(':','.').replace('$','@')


 
Eitan M





PostPosted: 2006-7-27 4:35:00 Top

java-programmer >> Differences between getImage and createImage and using Toolkit Hello,
What are the differences between getImage and createImage,
and what if I want using toolKit - (getImage and createImage are static,
and I didn't find a way to create an Image object from a function of
toolkit).

I need a sample code, please.

Thanks :)



 
 
Andrey Kuznetsov





PostPosted: 2006-7-27 14:34:00 Top

java-programmer >> Differences between getImage and createImage and using Toolkit > You mean, these methods are *not* static, don't you?
> Click "Use" at the top of the API doc of Toolkit. You find a list of
> methods that return a Toolkit.

e.g. Toolkit.getDefaultToolkit();

Andrey

--
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities


 
 
Oliver Wong





PostPosted: 2006-8-3 22:21:00 Top

java-programmer >> Differences between getImage and createImage and using Toolkit
"Eitan M" <email***@***.com> wrote in message
news:ea8g68$gd2$email***@***.com...
> Hello,
> What are the differences between getImage and createImage,
> and what if I want using toolKit - (getImage and createImage are static,
> and I didn't find a way to create an Image object from a function of
> toolkit).
>
> I need a sample code, please.

getImage and createImage are NOT static.

getImage will share instances of images, while createImage will create a
new instance each time.

google for "java load image".

- Oliver