Insert an image into button

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Insert an image into button

Postby petecheng » Mon Jun 13, 2005 10:00 am

I have the lastest version of SWT-Designer 4.0.1 I think

Eclipse 3.0.2

On the property of the Button, I click on Images on top, and I do see a list of images, that I put in the workspace.


When I select the image that I want, and click on Okay, the images doesn't show up...

I also run this Java Application, it didn't show up neither..

am I missing something here?

This is the source code it generates.

-------------------------------------------------------------

final Button button_4 = new Button(composite, SWT.FLAT);
button_4.setSize(26, 22);
button_4.setLocation(5, 5);
button_4.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
button_4.setImage(SWTResourceManager.getImage(CommodityList.class, "RESOURCE.120.GIF"));
button_4.setText("1");
--------------------------------------------------------------------


Thanks,
petecheng
 
Posts: 6
Joined: Mon Jun 13, 2005 7:37 am

Re: Insert an image into button

Postby Eric Clayberg » Mon Jun 13, 2005 11:04 am

petecheng wrote:When I select the image that I want, and click on Okay, the images doesn't show up

SWT Buttons may either have an image or a label; they can't have both. Clear the text entry for the widget and the image will appear.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Insert an image into button

Postby petecheng » Tue Jun 14, 2005 3:39 am

Eric Clayberg wrote:
petecheng wrote:When I select the image that I want, and click on Okay, the images doesn't show up

SWT Buttons may either have an image or a label; they can't have both. Clear the text entry for the widget and the image will appear.



very good, thanks
petecheng
 
Posts: 6
Joined: Mon Jun 13, 2005 7:37 am


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest