2 Nov 2010 11:15 AM #1
Displaying an image in a ToolBar
I'm trying to find the easiest way to display a logo (with a transparent background) in a Toolbar that's being used as a status bar.
I dropped in the following code:
ToolBar toolBar = new ToolBar(); ImageResources ir = GWT.create(ImageResources.class); ContentPanel logo = new ContentPanel(); logo.add(new Image(ir.logo)); logo.setHeaderVisible(false); logo.setBodyBorder(false); toolBar.add(logo);
I used Firebug to try and determine why this was the case, but couldn't unravel what was going on. It appeared that the background was set to be transparent, but it certainly doesn't look that way.
Any hints would be appreciated.
2 Nov 2010 11:45 AM #2
I dont nderstand why you wrap the Image into a ContentPanel. Can you please explain this? That is also the reason why it has a white background.
2 Nov 2010 12:07 PM #3
I've wrapped the Image because I can't add a com.google.gwt.user.client.ui.Image directly to the Toolbar - the add() method takes a com.extjs.gxt.ui.client.widget.Component.
I'm using ClientBundles, so is there an easy way to create a Component from an ImageResource?
I'm completely open to suggestions.
2 Nov 2010 12:09 PM #4Code:
toolBar.add(new WidgetComponent(new Image(ir.logo)));
2 Nov 2010 12:13 PM #5
By TheMonolith in forum Ext 3.x: Help & DiscussionReplies: 9Last Post: 22 Feb 2010, 6:41 AM
By rahesh in forum Ext 2.x: Help & DiscussionReplies: 12Last Post: 6 Feb 2009, 2:28 AM
By sachinsurvase in forum Ext GWT: Help & Discussion (1.x)Replies: 3Last Post: 30 Sep 2008, 9:24 PM
By JP_ExtJS in forum Ext 2.x: Help & DiscussionReplies: 11Last Post: 11 Apr 2008, 9:58 AM
By alks in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 16 Nov 2007, 4:31 AM