List of utility methods to do JTabbedPane
void | backwardTab(final Component... component) The focus goes back to the last component with CTRL + TAB. for (Component component1 : component) { component1.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, new HashSet<KeyStroke>( Arrays.asList(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, KeyEvent.CTRL_DOWN_MASK)))); |
void | checkHeavyWeightComponents(JTabbedPane tab) Walk the components of the tab and toggle the heavyweight components visiblity Component[] comps = tab.getComponents(); int selectedIdx = tab.getSelectedIndex(); for (int i = 0; i < comps.length; i++) { toggleHeavyWeightComponents(comps[i], i == selectedIdx); |
boolean | containsTab(JTabbedPane tabs, String name) contains Tab for (int i = 0; i < tabs.getTabCount(); i++) { if (tabs.getTitleAt(i).equals(name)) { return true; return false; |
JTabbedPane | createTabbedPane() create Tabbed Pane JTabbedPane tabbedPane = new JTabbedPane(); return tabbedPane; |
JTabbedPane | findParentJTabbedPane(JComponent c) find Parent J Tabbed Pane if (c == null) return null; Component parent = c.getParent(); while (!(parent instanceof JTabbedPane) && (parent != null)) { parent = parent.getParent(); return (JTabbedPane) parent; |
JPanel | getConfigPanelFromTabbedPane(JTabbedPane mainTabbedPane) get Config Panel From Tabbed Pane JPanel configPanel = null; Component[] mainComponents = mainTabbedPane.getComponents(); for (Component component : mainComponents) { if (component instanceof JScrollPane) { if ((component.getName() != null) && (component.getName().equals("mySettopsPane"))) { JScrollPane mySettopsPane = (JScrollPane) component; Component viewPortComponent = mySettopsPane.getComponent(0); JViewport viewPort = (JViewport) viewPortComponent; ... |
int | getIndexOf(JTabbedPane tabbedPane, Component component) get Index Of int result = -1; for (int i = 0; i < tabbedPane.getComponentCount(); i++) { Component comp = tabbedPane.getComponentAt(i); if (comp == component) { result = i; break; return result; |
JTabbedPane | getJTabbedPaneAncestor(Component c) get J Tabbed Pane Ancestor while (c != null) { if (c instanceof JTabbedPane) { return (JTabbedPane) c; c = c.getParent(); return null; |
String | getLineTabs(StyledDocument doc, int startOffset) get Line Tabs int i = startOffset; String s; try { do { s = doc.getText(i, 1); if ((i > 0 && !"\n".equals(s))) { i--; } else { ... |
int | getNextSubTabIndex(JTabbedPane tabs, int tabIndex) get Next Sub Tab Index int nextTabIndex = tabIndex; for (int i = 0; i < tabs.getComponentCount(); i++) { nextTabIndex++; if (nextTabIndex == tabs.getComponentCount()) { nextTabIndex = 0; if (tabs.isEnabledAt(nextTabIndex)) { break; ... |