Hi,
as far as I know there are no methods to access a specific cell in a
HorizontalPanel , maybe you could tweak around with getElement() or
something but I don't know

what you could do instead:

a) create an another Panel (vertical/horizontal ... doesn't matter),
put the image in it
put the styleName to this panel
put this panel in the original panel

     HorizontalPanel bannerPanel = new HorizontalPanel();
     bannerPanel.addStyleName("bannerPanel");
     Image logo = new Image("images/Logo220x57.png");
     HorizontalPanel logoWrapper = new HorizontalPanel();
     logoWrapper.setWith("220px");
     logoWrapper .add(logo);
     logoWrapper.addStyleName("bannerLogo") ; //or you could use
setStyleName();
     bannerPanel.add(logoWrapper);

or
b) use a grid instead of an HorizontalPanel
so that you have acces to the cell

                Grid grid = new Grid(1,0);
                grid.addStyleName("bannerPanel");
                Image logo = new Image("images/Logo220x57.png");
                // this could be put in a method that recives the "widget" and
you'll end up with a grid acting up more like an horizontal panel
                //---------------------
                int col=grid.getColumnCount();
                grid.resizeColumns(col+1);
                grid.setWidget(0, col, logo);
                //---------------------
                grid.getCellFormatter().addStyleName(0, col, "bannerLogo");

Anyway I hope that one of my ideas will help


On Dec 14, 6:06 pm, Eric <[email protected]> wrote:
> Hello all,
>
> Is it possible to get a handle on a particular cell in a
> HorizontalPanel?  I want to use a style sheet to set the background on
> the cell that contains the logo image.  I'm starting to feel like "you
> can't get there from here"  Is there some other way to approach the
> problem?  Why isn't there a "setCellStyleName" or similar method?
>
>     HorizontalPanel bannerPanel = new HorizontalPanel();
>     bannerPanel.addStyleName("bannerPanel");
>     Image logo = new Image("images/Logo220x57.png");
>     bannerPanel.add(logo);
>     // TODO figure out how to attach a style to the IMMEDIATE parent
>     logo.getParent().addStyleName("bannerLogo") ;  // This doesn't
> work.  It attaches the style to the whole <table>
>     bannerPanel.setCellWidth(logo, "220px");
>
> Thanks,
> Eric

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to