public class TabBarExample implements EntryPoint { public void onModuleLoad() { // Create a tab bar with three items. TabBar bar = new TabBar(); bar.addTab("foo"); bar.addTab("bar"); bar.addTab("baz"); // Hook up a tab listener to do something when the user selects a tab. bar.addTabListener(new TabListener() { public void onTabSelected(SourcesTabEvents sender, int tabIndex) { // Let the user know what they just did. Window.alert("You clicked tab " + tabIndex); } public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) { // Just for fun, let's disallow selection of 'bar'. if (tabIndex == 1) return false; return true; } }); // Add it to the root panel. RootPanel.get().add(bar); } }
TabBar() | Creates an empty tab bar. |
addTab(String) | Adds a new tab with the specified text. |
addTab(String, boolean) | Adds a new tab with the specified text. |
addTab(Widget) | Adds a new tab with the specified widget. |
addTabListener(TabListener) | Adds a listener interface to receive click events. |
getSelectedTab() | Gets the tab that is currently selected. |
getTabCount() | Gets the number of tabs present. |
getTabHTML(int) | Gets the specified tab's HTML. |
insertTab(String, boolean, int) | Inserts a new tab at the specified index. |
insertTab(String, int) | Inserts a new tab at the specified index. |
insertTab(Widget, int) | Inserts a new tab at the specified index. |
onClick(Widget) | Fired when the user clicks on a widget. |
removeTab(int) | Removes the tab at the specified index. |
removeTabListener(TabListener) | Removes a previously added listener interface. |
selectTab(int) | Programmatically selects the specified tab. |
true
to treat the specified text as htmltrue
to treat the specified text as HTMLtrue
if successful, false
if the
change is denied by the TabListener.