[英]Position of elements in Panel GWT
I want to know if it's possible to position different elements in a panel like an horizontalPanel
for example. 我想知道是否可以在例如
horizontalPanel
这样的面板中horizontalPanel
不同的元素。
In my Java code, I have an horizontalPanel
with two elements, one image and one Label. 在我的Java代码中,我有一个
horizontalPanel
,其中包含两个元素,一个图像和一个Label。
I want that my image to be in the left of the Panel and the Label in the middle. 我希望我的图像在面板的左侧,标签在中间。
For example: 例如:
HorizontalPanel pHeader = new HorizontalPanel();
Image movieData = new Image();
movieData.setUrl("http://i.myegy.to/images/1c58b25ce86e.original.png");
Label titleHead = new Label ("Movies");
pHeader.add(movieData);
pHeader.add(titleHead);
How can I place these both elements? 如何放置这两个元素?
Thank you for your help. 谢谢您的帮助。
Mickey74 Mickey74
You can use setCellHorizontalAlignment : 您可以使用setCellHorizontalAlignment :
pHeader.setCellHorizontalAlignment(movieData, HasHorizontalAlignment.ALIGN_LEFT);
pHeader.setCellHorizontalAlignment(titleHead, HasHorizontalAlignment.ALIGN_MIDDLE);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.