Bar*_*rry 8 gwt gwt-tablayoutpanel
如何在TabLayoutPanel中禁用选项卡(即用户无法在单击时打开选项卡)?我在线搜索但无法找到解决方案
谢谢
Jas*_*erk 10
TabLayoutPanel myPanel = new TabLayoutPanel();
// Add children...
myPanel.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
@Override
public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
// Simple if statement - your test for whether the tab should be disabled
// will probably be more complicated
if (event.getItem() == 1) {
// Canceling the event prevents the tab from being selected.
event.cancel();
}
}
});
Run Code Online (Sandbox Code Playgroud)
如果要为禁用选项卡设置与启用选项卡不同的样式,则可以使用TabLayoutPanel#getTabWidget选项卡窗口小部件并为其添加样式名称.
| 归档时间: |
|
| 查看次数: |
6819 次 |
| 最近记录: |