如何在 EXT-GWT 中拆分面板?
我正在使用 ext-gwt 并且不知道如何拆分面板,以便我有 2 个小部件,可调整大小的拆分器的每一侧各有一个,两个小部件的高度均为 100%,宽度可变。
本质上,我想要的是这样的:
-----------------------------------------
| Widget1 | Widget2 |
| | |
| | |
| | |
| | |
| <-|-> |
| | |
| | |
| | |
| | |
-----------------------------------------
我用 BorderLayout 尝试过,但我认为我做错了并且它不起作用(小部件的垂直高度不会占据全屏)。有人可以帮忙吗?这是我尝试过的最新形式:
public void onModuleLoad() {
Viewport v = new Viewport();
v.setLayout(new RowLayout(Orientation.HORIZONTAL));
ContentPanel panel1 = new ContentPanel();
panel1.setHeading("Panel 1");
ContentPanel panel2 = new ContentPanel();
panel2.setHeading("Panel 2");
v.add(panel1, new RowData(.3, 1));
v.add(new SplitBar(LayoutRegion.EAST, panel1));
v.add(panel2, new RowData(.7, 50));
RootPanel.get().add(v);
}
谢谢!
I'm using ext-gwt and can't figure out how to split a panel so that I have 2 widgets, one on each side of the resizeable splitter, with the height of both widgets being 100% and their widths being variable.
In essence, what I want is something like:
-----------------------------------------
| Widget1 | Widget2 |
| | |
| | |
| | |
| | |
| <-|-> |
| | |
| | |
| | |
| | |
-----------------------------------------
I tried it with BorderLayout, but I think I was doing it wrong and it wouldn't work (the vertical height of the widgets wouldn't take up the full screen). Can anyone help out? Here's the latest form of what I've tried:
public void onModuleLoad() {
Viewport v = new Viewport();
v.setLayout(new RowLayout(Orientation.HORIZONTAL));
ContentPanel panel1 = new ContentPanel();
panel1.setHeading("Panel 1");
ContentPanel panel2 = new ContentPanel();
panel2.setHeading("Panel 2");
v.add(panel1, new RowData(.3, 1));
v.add(new SplitBar(LayoutRegion.EAST, panel1));
v.add(panel2, new RowData(.7, 50));
RootPanel.get().add(v);
}
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
真的很简单。
首先确保您的视口具有合适的布局。
然后您可以使用如下所示的边框布局进行分割。将此面板添加到示例中的视口中。
(更喜欢边框布局而不是分割器,以防万一我以后想要更多区域)
然后只需将数据/小部件/面板添加到两个内容面板即可。
Pretty simple really.
First ensure that your Viewport has a fit layout.
Then you can use a border layout like follows for you split. Add this panel to your viewport in your example.
(Prefer border layouts to splitter just in case I want more areas later on)
Then just add your data/widgets/panels to the two content panels.