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

51 篇文章 0 订阅
50 篇文章 0 订阅

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");


 

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

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


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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值