Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Image from hard drive
Image from hard drive [message #125967] Mon, 23 March 2009 15:29 Go to next message
Eclipse UserFriend
Originally posted by: haglund86.hotmail.com

Hello.

I want to display a generated image in my RAP application.

The code I am using now does not work.

Label chart = new Label(p, SWT.NONE);
Image image = Graphics.getImage("C:\\Test.png");
chart.setImage(image);

But if I import the image to the project in Eclipse, then I can display
the image in my application.

However since I will be generating a lot of images this can not be done,
how should I workaround this issue?

What I want is to be able to display images directly from a specific
path at the servers hard drive.

//Erik
Re: Image from hard drive [message #125981 is a reply to message #125967] Mon, 23 March 2009 15:36 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 338
Registered: July 2009
Senior Member
Hi Erik,

as javadoc of getImage already states: the images need to be on the
classpath of the application.
Alternativly you can use the getImage(String, InputStream) factory
method to load images from an input stream.

Cheers
Benny

Erik Haglund wrote:
> Hello.
>
> I want to display a generated image in my RAP application.
>
> The code I am using now does not work.
>
> Label chart = new Label(p, SWT.NONE);
> Image image = Graphics.getImage("C:\\Test.png");
> chart.setImage(image);
>
> But if I import the image to the project in Eclipse, then I can display
> the image in my application.
>
> However since I will be generating a lot of images this can not be done,
> how should I workaround this issue?
>
> What I want is to be able to display images directly from a specific
> path at the servers hard drive.
>
> //Erik


--
Benjamin Muskalla | EclipseSource Karlsruhe
http://www.eclipsesource.com | http://twitter.com/eclipsesource
Re: Image from hard drive [message #125993 is a reply to message #125967] Mon, 23 March 2009 15:40 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2359
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Erik,
actually the image must be in the application class path. There is one
more possibility to load the image from an input stream - see
Graphics#getImage( String, InputStream ).
Best,
Ivan

Erik Haglund wrote:
> Hello.
>
> I want to display a generated image in my RAP application.
>
> The code I am using now does not work.
>
> Label chart = new Label(p, SWT.NONE);
> Image image = Graphics.getImage("C:\\Test.png");
> chart.setImage(image);
>
> But if I import the image to the project in Eclipse, then I can
> display the image in my application.
>
> However since I will be generating a lot of images this can not be
> done, how should I workaround this issue?
>
> What I want is to be able to display images directly from a specific
> path at the servers hard drive.
>
> //Erik
Re: Image from hard drive [message #126004 is a reply to message #125967] Mon, 23 March 2009 17:01 Go to previous message
p-lex is currently offline p-lexFriend
Messages: 18
Registered: July 2009
Junior Member
If you create an Image using an InputStream, you should know, that this
InputStream will be written by the rap-image-handling to an image-file on
your hard-drive. This way rap can link to this image. You will have the
same image file twice on hd. You dont have to write an image file if you
want use an generated image. Instead you can just use the
createImage(String, InputStream) method. But if the number of generated
file could be very much, you should know that there is no way to delete
this rap generated image files...

see
http://www.eclipse.org/newsportal/article.php?id=5682&gr oup=eclipse.technology.rap#5682
for more details
Previous Topic:RAP support for other Eclipse bundles
Next Topic:Menubar disappears if setted at runtime
Goto Forum:
  


Current Time: Tue Nov 30 04:17:33 GMT 2021

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

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

Back to the top