Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » add image to label (XWT)(How to add image to form)
add image to label (XWT) [message #1614900] Fri, 13 February 2015 15:17 Go to next message
Elena Harz is currently offline Elena HarzFriend
Messages: 11
Registered: December 2014
Junior Member
Hello,

I'am using Window Builder XWT to create UI.
I am trying to add an image to label. In image chooser dialog i can find my images only if i pack them to jar and add to build path. But also after that the label is empty and does not contain any images. Do I something wrong? Ther are any way to add image in xwt?

Best regards,
Elena

Re: add image to label (XWT) [message #1616825 is a reply to message #1614900] Sat, 14 February 2015 21:59 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
Is the code generated correctly? Does it work when you run it?
Re: add image to label (XWT) [message #1619014 is a reply to message #1616825] Mon, 16 February 2015 09:25 Go to previous messageGo to next message
Elena Harz is currently offline Elena HarzFriend
Messages: 11
Registered: December 2014
Junior Member
Hello,
I have only created new XWT Application. The .xwt and .java files are ok. Now I'm trying to add a label with image. I'v added an image to label via image chooser and removed the text of the label. In design mode the label is empty. The code can be run in preview mode, the label stays empty.
Re: add image to label (XWT) [message #1619020 is a reply to message #1619014] Mon, 16 February 2015 09:25 Go to previous messageGo to next message
Elena Harz is currently offline Elena HarzFriend
Messages: 11
Registered: December 2014
Junior Member
This is the generated .xwt file:

<Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt" x:Class="testbinding.XwtApplication" layout="{x:Null}">
	<Button text="Double click me!" bounds="3, 3, 100, 25"/>
	<Label image="/Images/test.png" bounds="106, 3, 138, 60"/>
</Shell>
Re: add image to label (XWT) [message #1620932 is a reply to message #1619020] Tue, 17 February 2015 14:43 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
Does it work when you run it?
Re: add image to label (XWT) [message #1621009 is a reply to message #1620932] Tue, 17 February 2015 15:54 Go to previous messageGo to next message
Elena Harz is currently offline Elena HarzFriend
Messages: 11
Registered: December 2014
Junior Member
Unfortunately no.

But theoretically images are supported in WB XWT?
Re: add image to label (XWT) [message #1621015 is a reply to message #1621009] Tue, 17 February 2015 15:58 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
If it does not work when you run it, then either the code is not being generated correctly or there is an XWT issue.

You should try hand editing the code to see if you can get it to work with XWT by itself. We can then see if there is a code generation problem.
Re: add image to label (XWT) [message #1692116 is a reply to message #1621015] Mon, 13 April 2015 14:55 Go to previous message
Elena Harz is currently offline Elena HarzFriend
Messages: 11
Registered: December 2014
Junior Member
Hello,

sorry for the late answer.

I was able to display images in WindowBuilder after manually manipulation of xwt file. If I put the needed image into the project with xwt file and set the image attribute of the label to the path of the icons relative to the xwt file, than the WindowBuilder displays the image correctly even at design time:

<Label image="example.png"/>

But the WindowBuilder image chooser dialog allows to select only images from jars on classpath and generates an 'image'-attribute with path to the image.
Also after manuall manipulation of xwt file I have not found any way to reference an image from jar in xwt and get it working.

Why does not WindowBuilder allow to choose an image from the project? Should the image be always in jar on the classpath? Or I use the WB wrong?

Thanks in advance!

Elena
Previous Topic:window builder & rap platform
Next Topic:WB Source Code?
Goto Forum:
  


Current Time: Sat Nov 17 16:51:18 GMT 2018

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

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

Back to the top