Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GWT-将复合材料与右侧对齐_Gwt_Alignment - Fatal编程技术网

GWT-将复合材料与右侧对齐

GWT-将复合材料与右侧对齐,gwt,alignment,Gwt,Alignment,在GWT中,我需要一个类似于Eclipse视图的组合 视图组合包含垂直放置的其他组合 第一行是带有多个按钮的视图工具栏。用户单击它们以执行某些操作。 工具栏必须和视图组合的右侧对齐 放置在第二行和后续行中的复合材料用于 显示一些值。这些将与视图的左侧对齐 混合成的 通过下面的代码片段,我能够将工具栏向右对齐,并将其余的组合放置在左侧 CaptionPanel view = new CaptionPanel("Eclipse like view"); VerticalPanel vP

在GWT中,我需要一个类似于Eclipse视图的组合

  • 视图组合包含垂直放置的其他组合

  • 第一行是带有多个按钮的视图工具栏。用户单击它们以执行某些操作。 工具栏必须和视图组合的右侧对齐

  • 放置在第二行和后续行中的复合材料用于 显示一些值。这些将与视图的左侧对齐 混合成的


通过下面的代码片段,我能够将工具栏向右对齐,并将其余的组合放置在左侧

CaptionPanel view = new CaptionPanel("Eclipse like view");
VerticalPanel vPanel = new VerticalPanel();
view.setContentWidget(vPanel);

ViewToolbar toolbar = new ViewToolbar();   // custom composite
vPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
vPanel.add(toolbar);        

ViewContent viewContent = new ViewContent(); // custom composite
vPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
vPanel.add(viewContent);
这是需要的。但我不知道这样调整水平对齐是否是个好主意


有没有更好的方法将一些复合材料与面板的右侧对齐,而将其他复合材料与面板的左侧对齐。

在我看来,使用HasHorizontalAlignment之类的方法。如果必须永不更改,则左对齐是一种好方法

另一种方法是使用CSS声明和类似myThing.addStyleName(myCustomStyle)


或者使用uibinder的方式进行样式声明

此外,我建议使用简单的FlowPanel而不是(基于HTML表的)VerticalPanel,因为您不再需要
setHorizontalAlignment()
方法。