How to workaround SWTResourceManager.getImage

samhu samhuatgmailnotwork. at gmail.com
Sun Oct 6 02:46:38 PDT 2013


On Sunday, 6 October 2013 at 08:52:39 UTC, Jacob Carlborg wrote:
> On 2013-10-06 08:35, samhu wrote:
>> Greetings!
>>
>> I am trying to compile below dummyeclipse project ,but first
>> encountered the subjected issue.I knew to form a Image object 
>> one
>> can use:
>> [code]
>> Image image=new Image(display,imgfilename);//e.g. smile.jpg
>> [/code]
>> But I don't know how to load from a resource file(*.res) to 
>> form
>> a image as used in DWT java:
>> [code]
>> (new Label).setImage(SWTResourceManager.getImage("PROP_PS",
>> GIFFILE));
>> [/code]
>
> I really don't see the difference between 
> "SWTResourceManager.getImage" and "new Image". The only thing 
> that SWTResourceManager does in addition is cache the image.
>
> SWTResourceManager is not part of standard SWT, it a part of 
> WindowBuilder.
>
> You can also port it do D :
>
> http://dev.eclipse.org/svnroot/tools/org.eclipse.windowbuilder/trunk/org.eclipse.wb.rcp/resources/1.5/org/eclipse/wb/swt/SWTResourceManager.java

Sorry.But do you mean with new Image can also work on *.res file?
There is only one resource.res file which contains the above 
mentioned PROP_PS_GIFFILE ,please note there is no somefile.gif 
or somefile.jpg for the project.


More information about the Digitalmars-d-dwt mailing list