读书人

Vaadin Web应用开发课程(34):UI布局-T

发布时间: 2012-09-14 11:53:44 作者: rapoo

Vaadin Web应用开发教程(34):UI布局-TabSheet布局

TabSheet布局支持标签显示。TabSheet布局通过方法 addTab()添加一个标签页。

// Create an empty tab sheet.TabSheet tabsheet = new TabSheet(); // Make the tabsheet shrink to fit the contents.tabsheet.setSizeUndefined();tabsheet.addTab(new Label("Contents of the first tab")).setCaption("first");tabsheet.addTab(new Label("Contents of the second tab")).setCaption("second");tabsheet.addTab(new Label("Contents of the third tab")).setCaption("third");


Vaadin Web应用开发课程(34):UI布局-TabSheet布局

每个标签页为一Tab对象,可以显示标题和图标。

tabsheet.addTab(new Label("Contents of the second tab"),          "Second Tab",          new ClassResource("images/Venus_small.png", this));


用户点击标签时触发TabSheet.SelectedTabChangeEvent事件,获取当前选中的标签的方法为getSelectedTab(),同样将某个标签设为当前页为setSelectedTab()。

读书人网 >Web前端

热点推荐