1. image on a button; 2. SVG support in RAP? [message #46661] |
Wed, 12 September 2007 14:25 |
Eclipse User |
|
|
|
Originally posted by: s5824917.inf.tu-dresden.de
Hi folks,
1. question:
I got a little RAP-HelloWorld application to run. Now I am trying to set an
image on a button.
I tried the following:
Image img = org.eclipse.rwt.graphics.Graphics.getImage("info.gif");
button2.setImage(img);
but the image doesn't show up, actually I get
"Unable to create view: Argument not valid
Image 'info.gif' cannot be found"
So the image can not be found, but I read the InputStream that is being used
here searches the classpath...
"Note: This method searchs the classpath of the current web-application"
InputStream getResourceAsStream( String name );
Structure and position of the image: (so you can see where I put the
info.gif file)
RAPHelloWorld
/ src
/ src / org.eclipse.rap.hellworld
/...
/icons
/META-INF
/info.gif
Can someone help a newbie like me to get this to work?
2. question:
Is it possible to use other objects inside the views too, like SVG or
external Javascript?
So that I could build two views in a perspective, one view with the
SVG-image and one
with options to manipulate said SVG-image.
how hard would it be to accomplish that?
|
|
|
|
|
|
Re: 1. image on a button; 2. SVG support in RAP? [message #48782 is a reply to message #48666] |
Fri, 21 September 2007 14:53 |
Eclipse User |
|
|
|
Originally posted by: jkrause.innoopract.com
It is just those two lines of code, you don't need to know anything
about classloaders:
ClassLoader imageLoader = getClass().getClassLoader();
Image image1 = Graphics.getImage( "icons/info.gif", imageLoader );
And you need to put the image either on the source path, or, like in
this example in the icons folder of the plugin.
Ingo Kaulbach wrote:
> Is there an other, easier, way to load the Image?
> I am not familar with the ClassLoader-Stuff...
>
|
|
|
Powered by
FUDForum. Page generated in 0.04827 seconds