Newbie Alert:
I have been furiously looking for a way to size a particular cell of a HorizontalPanel.
What I am trying to do is implement a 2-cell Horizontal Panel and set the left cell to say 200px. However, I am trying to make the right cell fill the rest of the window, not its cells contents.
I cannot see the wood开发者_高级运维 for the trees, please help...
HorizontalPanel horizontalPanel=new HorizontalPanel();
horizontalPanel.setWidth("100%");
Widget widget1=new Widget();
Widget widget2=new Widget();
horizontalPanel.add(widget1);
horizontalPanel.add(widget2);
horizontalPanel.setCellWidth(widget1,"200");
In above code if the widget2's width is set to 100% then widget2 will fill rest of the window.If the widget2's width is not 100% it will not fill rest of the window.Just check the width of your second cell content.It should not be 100%.
I found I needed to tweak Damo's answer slightly to make this work. You have to set the explicit size of the widget in the first cell. But then set the second cell to have a width of 100%.
<g:HorizontalPanel width="100%">
<g:cell>
<g:SimplePanel width="200px"/>
</g:cell>
<g:cell width="100%">
<g:SimplePanel width="100%"/>
</g:cell>
</g:HorizontalPanel>
Or if you are doing this with UiBinder:
<g:HorizontalPanel width="100%">
<g:cell width="200">
<!-- Stuff -->
</g:cell>
<g:cell>
<!-- More Stuff -->
</g:cell>
</g:HorizontalPanel>
精彩评论