0

I have been struggling with a problem and searching the web did not yield any result.

Basically I am trying to create in GWT ( plain GWT without ext or smart) a tab panel.

The catch is that I need the tabs to be on the bottom of the panel, not at the top, how they are by default.

Do you have any ideas on how I can achieve this?

Thank you.

Update 1: (To be more clear I have added screenshots) What is the default -> default tab position

What I need -> needed tab position

  • See http://stackoverflow.com/questions/10736400/tablayoutpanel-at-the-bottom-of-the-page-in-gwt – nerdlyist Jun 22 '16 at 18:39
  • Hi @nerdlyist , thanks for the link. However what I actually want is not to place the whole tab panel at the bottom of the page, but to place the tabs at the bottom of the tab panel. I will update my post with screenshots. – Vlad Turian Jun 22 '16 at 19:57

1 Answers1

2

The TabPanel is actually an aggregate of a TabBar and a DeckPanel widgets. You can arrange them as you like. All you have to do is to addSelectionHandler (or addBeforeSelectionHandler) to the TabBar that will showWidget (according to selected tab) on the DeckPanel.

For example:

TabBar tabs = new TabBar();
final DeckPanel deck = new DeckPanel(); 

for(int i = 0; i < 5; i++) {
    tabs.addTab("Tab " + Integer.toString(i + 1));
    deck.add(new Label("Label " + Integer.toString(i + 1)));
}

tabs.addSelectionHandler(new SelectionHandler<Integer>() {
    @Override
    public void onSelection(SelectionEvent<Integer> event) {
        deck.showWidget(event.getSelectedItem());
    }
});

VerticalPanel vPanel = new VerticalPanel();
vPanel.add(deck);
vPanel.add(tabs);

tabs.selectTab(0);
Adam
  • 5,403
  • 6
  • 31
  • 38
  • thank you for the response. It works. For the future I will add some styling and maybe do this with UiBinder. Certainly a great answer. – Vlad Turian Jun 24 '16 at 15:36