Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Graphics.getImage("path...") -> IllegalArgumentException: Argument not validImage(How to load images for applicationwide layout?)
Graphics.getImage("path...") -> IllegalArgumentException: Argument not validImage [message #506743] Sat, 09 January 2010 11:25 Go to next message
Eduard  is currently offline Eduard Friend
Messages: 29
Registered: September 2009
Junior Member
Hello RAP-Community?

I am trying to load some images for use in my layout.

I found two ways for loading images:

1. Load images from a plugin
ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(pluginID, pathToImage);
descriptor.createImage();

This works fine. I can create images form other plugins and also from the same plugin in which the code is execuded.

2. Load images within a plugin through
Graphics.getImage("images/background.png");

When I try this I get the folloging errror:
Quote:
Argument not validImage 'images/background.png' cannot be found.

The code is executed from within the plugin where the image resides. The images are also included in the binary build.

Why is the second way for loading images not working? I tried also to put a '/' in front of the imagepath. Unfortuneately no success.

Which way for loading images from the same plugin is prefered?

Best Regards
Eduard Seibel

[Updated on: Sat, 09 January 2010 06:25]

Report message to a moderator

Re: Graphics.getImage("path...") -> IllegalArgumentException: Argument not validImage [message #506910 is a reply to message #506743] Mon, 11 January 2010 05:28 Go to previous message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi Eduard,

Graphics#getImage() works fine for me. Maybe specifying the classloader
of the bundle where the images are located helps?

How does your bundle structure and your build.properties look like?

Regards,
Stefan.



Eduard schrieb:
> Hello RAP-Community?
>
> I am trying to load some images for use in my layout.
>
> I found two ways for loading images:
>
> 1. Load images from a plugin
> ImageDescriptor descriptor =
> AbstractUIPlugin.imageDescriptorFromPlugin(pluginID, pathToImage);
> descriptor.createImage();
>
> This works fine. I can create images form other plugins and also from
> the same plugin in which the code is execuded.
>
> 2. Load images within a plugin through
> Graphics.getImage("images/background.png");
>
> When I try this I get the folloging errror: Quote:
>> Argument not validImage 'images/background.png' cannot be found.
>
>
> The code is executed from within the plugin where the image resides. The
> images are also included in the binary build.
>
>
>
> Why is the second way for loading images not working? I tried also to
> put a '/' in front of the imagepath. Unfortuneately no success.
>
> Which way for loading images from the same plugin is prefered?
>
> Best Regards
> Eduard Seibel
Previous Topic:Design implementation issue [Fancy, Business]
Next Topic:Shell clipped within a View possible?
Goto Forum:
  


Current Time: Fri Dec 03 08:16:32 GMT 2021

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

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

Back to the top