Here you can find the source of getNextSubTabIndex(JTabbedPane tabs, int tabIndex)
public static int getNextSubTabIndex(JTabbedPane tabs, int tabIndex)
//package com.java2s; //License from project: Open Source License import javax.swing.JTabbedPane; public class Main { public static int getNextSubTabIndex(JTabbedPane tabs, int tabIndex) { int nextTabIndex = tabIndex; for (int i = 0; i < tabs.getComponentCount(); i++) { nextTabIndex++;/*from www .ja v a 2s .c o m*/ if (nextTabIndex == tabs.getComponentCount()) { nextTabIndex = 0; } if (tabs.isEnabledAt(nextTabIndex)) { break; } } return nextTabIndex; } }