1
我想要創建選項卡式頁面並在每個選項卡上單擊加載不同的信息。使用GWT中的選項卡動態添加選項卡
我希望能夠在點擊'+'選項卡時動態添加選項卡。
因此,點擊'+'後,應將新選項卡添加到同一個tabLayoutPanel。
有關如何在GWT中執行此操作的任何建議。
謝謝。
我想要創建選項卡式頁面並在每個選項卡上單擊加載不同的信息。使用GWT中的選項卡動態添加選項卡
我希望能夠在點擊'+'選項卡時動態添加選項卡。
因此,點擊'+'後,應將新選項卡添加到同一個tabLayoutPanel。
有關如何在GWT中執行此操作的任何建議。
謝謝。
你也可以添加到一個tabpanel空+小部件,然後在一個tabpanel添加selectionChangeHandler
檢測點擊+標籤,其中添加新的選項卡,並選中它。
所以+
標籤做的工作,從未顯示:
tabPanel.add(new Label(), "+");
tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
@Override
public void onSelection(SelectionEvent<Integer> event) {
if (event.getSelectedItem() == tabPanel.getWidgetCount() - 1) {
Widget w = new Label(); // the widget which contains the new tab
tabPanel.insert(w, w.toString(),
tabPanel.getWidgetCount() - 1);
tabPanel.selectTab(w);
}
}
});