Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » newbie question
newbie question [message #480397] Sun, 16 August 2009 18:45 Go to next message
Eclipse UserFriend
Originally posted by: vicenterg.arrakis.es

Is it possible to load an image from a file without create a new image?
I mean:

I know we can do the following:

Image image=new Image(display, nameOfFile)....

But, can i load an image whithout use "new Image". I have a table and i
will to add an icon to a tableitem . If i do "new image", i must dispose
this image later. I wish to know whether i can load an image directly
from a file in the HD, something like:

Image image=loadImageFromDisk(nameOfFile), and later do:

tableItem.setImage(image).

This way i don't need to dispose it because i haven't created with "new
Image".


Is this possible? Thanks!!!
Re: newbie question [message #480588 is a reply to message #480397] Mon, 17 August 2009 18:28 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

No, you'll have to dispose the images you create. You can, however, share images if you include the JFace libraries.

See org.eclipse.jface.resource.ImageDescriptor which can be used to reference an image without creating it.

To have your application share images, you can use ImageDescriptor and org.eclipse.jface.resource.JFaceResources.getResources() / org.eclipse.jface.resource.LocalResourceManager to cache/reuse images.

PW


Previous Topic:Wrap Label
Next Topic:Transparent Image as layer
Goto Forum:
  


Current Time: Fri Apr 19 04:47:07 GMT 2024

Powered by FUDForum. Page generated in 0.02024 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top