to show a specific panel accordingly to the selected tab
321580
public void navigateHandlerView() {
        // if endpoint tab
        if (tabLayoutpanel.getSelectedIndex() == 1) {
            if (endpointHandlerPages.getPage() == 0)
                endpointHandlerPages.showPage(1);
        // else the client tab
        } else if (tabLayoutpanel.getSelectedIndex() == 2) {
            if (clientHandlerPages.getPage() == 0)
                clientHandlerPages.showPage(1);
        }
    }
687630
function tabBrowser_getTab(index) {
    if (index === undefined)
      index = this.selectedIndex;

    return this.getElement({type: "tabs_tab", subtype: "index", value: index});
  }
269364
function switchTab(tab){
  var tabEl = document.getElementById('sidebar_switch');
  var children = tabEl.childNodes;

  // Easiest way to go through tabs without any kind of selector is just to look at the tab bar
  for(var i = 0, l = children.length; i < l;  i += 1){
    // Ignore text nodes
    if(children[i].nodeType !== 1) continue;

    // Figure out what tab pane this tab button corresponts to
    var t = children[i].className.replace(/\s.*$/,'');
    if(t === tab){
      // Show the tab pane, select the tab button
      document.getElementById(t).style.display = 'block';
      if(children[i].className.indexOf('selected') === -1) children[i].className += ' selected';
    }else{
      // Hide the tab pane, deselect the tab button
      document.getElementById(t).style.display = 'none';
      children[i].className = children[i].className.replace(/\sselected/,'');
    }
  }

  // Store the last open tab in localStorage
  if(window.localStorage) window.localStorage.otis_sidebarTab = tab;
}
130683
function(showTabMenu) {
		if( this.tabs.length === 0 ) {
			return;
		}

		//Show the menu based on function argument
		this.tabDropdownButton.element.toggle(showTabMenu === true);

		var size = function( val ) {
			return val ? 'width' : 'height';
		};
		this.element.css( size( !this.parent._sided ), '' );
		this.element[ size( this.parent._sided ) ]( this.layoutManager.config.dimensions.headerHeight );
		var availableWidth = this.element.outerWidth() - this.controlsContainer.outerWidth() - this._tabControlOffset,
			cumulativeTabWidth = 0,
			visibleTabWidth = 0,
			tabElement,
			i,
			j,
			marginLeft,
			overlap = 0,
			tabWidth,
			tabOverlapAllowance = this.layoutManager.config.settings.tabOverlapAllowance,
			tabOverlapAllowanceExceeded = false,
			activeIndex = (this.activeContentItem ? this.tabs.indexOf(this.activeContentItem.tab) : 0),
			activeTab = this.tabs[activeIndex];
		if( this.parent._sided )
			availableWidth = this.element.outerHeight() - this.controlsContainer.outerHeight() - this._tabControlOffset;
		this._lastVisibleTabIndex = -1;

		for( i = 0; i < this.tabs.length; i++ ) {
			tabElement = this.tabs[ i ].element;

			//Put the tab in the tabContainer so its true width can be checked
			this.tabsContainer.append( tabElement );
			tabWidth = tabElement.outerWidth() + parseInt( tabElement.css( 'margin-right' ), 10 );

			cumulativeTabWidth += tabWidth;

			//Include the active tab's width if it isn't already
			//This is to ensure there is room to show the active tab
			if (activeIndex <= i) {
				visibleTabWidth = cumulativeTabWidth;
			} else {
				visibleTabWidth = cumulativeTabWidth + activeTab.element.outerWidth() + parseInt(activeTab.element.css('margin-right'), 10);
			}

			// If the tabs won't fit, check the overlap allowance.
			if( visibleTabWidth > availableWidth ) {

				//Once allowance is exceeded, all remaining tabs go to menu.
				if (!tabOverlapAllowanceExceeded) {

					//No overlap for first tab or active tab
					//Overlap spreads among non-active, non-first tabs
					if (activeIndex > 0 && activeIndex <= i) {
						overlap = ( visibleTabWidth - availableWidth ) / (i - 1);
					} else {
						overlap = ( visibleTabWidth - availableWidth ) / i;
					}

					//Check overlap against allowance.
					if (overlap < tabOverlapAllowance) {
						for ( j = 0; j <= i; j++ ) {
							marginLeft = (j !== activeIndex && j !== 0) ? '-' + overlap + 'px' : '';
							this.tabs[j].element.css({'z-index': i - j, 'margin-left': marginLeft});
						}
						this._lastVisibleTabIndex = i;
						this.tabsContainer.append(tabElement);
					} else {
						tabOverlapAllowanceExceeded = true;
					}

				} else if (i === activeIndex) {
					//Active tab should show even if allowance exceeded. (We left room.)
					tabElement.css({'z-index': 'auto', 'margin-left': ''});
					this.tabsContainer.append(tabElement);
				}

				if (tabOverlapAllowanceExceeded && i !== activeIndex) {
					if (showTabMenu) {
						//Tab menu already shown, so we just add to it.
						tabElement.css({'z-index': 'auto', 'margin-left': ''});
						this.tabDropdownContainer.append(tabElement);
					} else {
						//We now know the tab menu must be shown, so we have to recalculate everything.
						this._updateTabSizes(true);
						return;
					}
				}

			}
			else {
				this._lastVisibleTabIndex = i;
				tabElement.css({'z-index': 'auto', 'margin-left': ''});
				this.tabsContainer.append( tabElement );
			}
		}

	}
257044
function setupAddonBarWidget() {
  var panel = panels.Panel({
    width: 200,
    height: 128,
    contentURL: self.data.url('widget-panel.html'),
    contentScriptFile: self.data.url('widget-panel.js')
  });
  panel.on('show', function() {
    var url = getCanonicalUrl(tabs.activeTab.url);
    if (!url.length) {
      panel.port.emit('show', null);
    } else {
      panel.port.emit('show', {
        'enabled': isInjectionEnabledForUrl(url)
      });
    }
  });
  panel.port.on('perform', function(action) {
    switch (action) {
      case 'toggle':
        toggleInjectionForActiveTab();
        panel.hide();
        break;
      case 'reset':
        resetOptionsForActiveTab();
        panel.hide();
        break;
      case 'show_ui':
        showUi();
        panel.hide();
        break;
    }
  });

  var widget = widgets.Widget({
    id: 'wtf-toggle',
    label: 'Toggle Web Tracing Framework',
    contentURL: self.data.url('widget.html'),
    contentScriptFile: self.data.url('widget.js'),
    panel: panel
  });

  // Update the widget icon when the URL changes.
  function tabChanged() {
    var url = getCanonicalUrl(tabs.activeTab.url);
    widget.port.emit('update', {
      'enabled': url.length ? isInjectionEnabledForUrl(url) : false
    });
  };
  tabs.on('open', tabChanged);
  tabs.on('close', tabChanged);
  tabs.on('ready', tabChanged);
  tabs.on('activate', tabChanged);
  tabs.on('deactivate', tabChanged);
}
1268389
public void highlight() {
		final JTabbedPane parent = (JTabbedPane) this.getUiComponent().getParent();

		//search through tabs until we find this one
		for (int i = 0; i < parent.getTabCount(); i++) {
			String title = parent.getTitleAt(i);

			if (getTabCaption().equals(title)) {  //found this tab
				//create new colored label and set it into the tab
				final JLabel label = new JLabel(getTabCaption());
				label.setForeground(new Color(0xff6633));
				parent.setTabComponentAt(i, label);

				//schedule a task to change back to original color
				Timer timer = new Timer();

				TimerTask task = new TimerTask() {
					@Override
					public void run() {
						label.setForeground(Color.black);
					}
				};

				timer.schedule(task, 3000);

				break;
			}
		}
	}
643546
def show
      Ncurses::Panel.top_panel(@panel)
      update_reterm

      @@registry.values.each { |panel|
        if panel == self
          dispatch :panel_show
        else
          panel.dispatch :panel_hide
        end
      }
    end
416840
private int getSelectedTab() {
        String theme = "default";
        List<PageParameters.NamedPair> pairs = getPageParameters().getAllNamed();
        theme = pairs.get(0).getValue();
        if ("grid".equals(theme)) {
            return 1;
        } else if ("skies".equals(theme)) {
            return 2;
        } else if ("gray".equals(theme)) {
            return 3;
        } else if ("darkblue".equals(theme)) {
            return 4;
        } else if ("darkgreen".equals(theme)) {
            return 5;
        } else {
            return 0;
        }
    }
1014608
public void selectTab(GalleryTabId tabId, boolean fireEvent) {

        A_CmsTab tab = getTab(tabId);
        if (tab != null) {
            m_tabbedPanel.selectTab(tab, fireEvent);
        }
    }
832882
function selectTab() {
        layout.resetTabState_(tabs);
        tab.classList.add(layout.CssClasses_.IS_ACTIVE);
    }
1014963
function(element, options) {
        var self = this;

        element = this.setElement(element).attr('role', 'tablist');
        options = this.setOptions(options, element);

        // Find headers and cache the index of each header and set ARIA attributes
        this.headers = element.find(this.ns('header')).each(function(index) {
            $(this)
                .data('accordion-index', index)
                .attr({
                    role: 'tab',
                    id: self.id('header', index)
                })
                .aria({
                    controls: self.id('section', index),
                    selected: false,
                    expanded: false
                });
        });

        // Find sections and cache the height so we can use for sliding and set ARIA attributes
        this.sections = element.find(this.ns('section')).each(function(index) {
            $(this)
                .attr({
                    role: 'tabpanel',
                    id: self.id('section', index)
                })
                .aria('labelledby', self.id('header', index))
                .conceal();
        });

        // Set events
        this.addEvents([
            ['horizontalresize', 'window', $.debounce(this.calculate.bind(this))],
            ['{mode}', 'element', 'onShow', this.ns('header')]
        ]);

        // Initialize
        this.initialize();

        // Jump to the index on page load
        this.calculate();
        this.jump(options.defaultIndex);
    }
1249109
protected void switchTab() {

        Component tab = m_tab.getSelectedTab();
        int pos = m_tab.getTabPosition(m_tab.getTab(tab));
        if (m_isWebOU) {
            if (pos == 0) {
                pos = 1;
            }
        }
        m_tab.setSelectedTab(pos + 1);
    }
11750
private void showTab() {
		if (parentTab != null) {
			tab = parentTab.getTab(this);
			if (tab != null) {
				// FIXME: this should be added by the constructor or by the panel that adds this
				// tab
				// tab.getComponent().addStyleName("example-queries-tab");
				tab.setEnabled(true);

				if (!(parentTab.getSelectedTab() instanceof ResultViewPanel)) {
					parentTab.setSelectedTab(tab);
				}
			}
		}

	}
379998
private void createTabbedPane()
	{

		tabs = new JTabbedPane();
		tabs.setBounds(5, 5, 580, 300);

		tabs.add("Mode", new ModePanel(controller));
		tabs.add("Externals", new ExternalProgramsPanel(controller));
		tabs.add("Input", new InputPanel(controller));
		tabs.add("Output", new OutputPanel(controller));
		tabs.add("Database", new SQLPanel(controller));
		tabs.add("Cache", new CachePanel(controller));
		tabs.add("Logging", new LoggingPanel(controller));
		tabs.add("Debug", new DebugPanel(controller));
		tabs.add("Filter", new FilterPanel(controller));

		this.add(tabs);

	}
183841
public void show() {

        if (m_isFrame) {
            RootPanel root = RootPanel.get();
            root.getElement().getStyle().setMargin(0, Unit.PX);
            root.getElement().getStyle().setPadding(0, Unit.PX);
            RootPanel.get().add(m_main);
            m_isShowing = true;
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                public void execute() {

                    adjustContentSize();
                }
            });
        } else {
            m_popup.center();
        }

    }
354345
def create_current_pb(self, ):
        
        pb = QtGui.QPushButton("Select current")
        self.selection_tabw.setCornerWidget(pb)
        return pb
179768
function(start) {
        var itemsToShow = this.options.itemsToShow,
            length = this.items.length,
            stop = start + itemsToShow,
            set = $([]),
            tabs = this.tabs
                .removeClass('is-active')
                .aria('toggled', false);

        if (!tabs.length) {
            return;
        }

        if (this.options.infinite) {
            length = length - (itemsToShow * 2);
        }

        if (start >= 0) {
            set = set.add(tabs.slice(start, stop));
        } else {
            set = set.add(tabs.slice(0, stop));
            set = set.add(tabs.slice(start));
        }

        if (stop > length) {
            set = set.add(tabs.slice(0, stop - length));
        }

        set
            .addClass('is-active')
            .aria('toggled', true);
    }