public void previousTab() { int t = tabbedPane.getSelectedIndex(); if (t == 0) { t = tabbedPane.getTabCount() - 1; } else { t--; } tabbedPane.setSelectedIndex(t); }
public boolean selectTabWith(File file) { for (int i = 0; i < tabbedPane.getTabCount(); i++) { if (tabbedPane.getComponentAt(i) instanceof Tab) { Tab tab = (Tab) tabbedPane.getComponentAt(i); if (tab.getFile() != null && tab.getFile().equals(file)) { tabbedPane.setSelectedIndex(i); return true; } } } return false; }
public void help(String title, String path, boolean navigation) { for (int i = 0; i < tabbedPane.getTabCount(); i++) { if (!(tabbedPane.getComponentAt(i) instanceof Tab)) { if (tabbedPane.getTitleAt(i).equals(title) || tabbedPane.getTitleAt(i).startsWith(title + "-")) { tabbedPane.setSelectedIndex(i); return; } } } JComponent help; if (navigation) { help = new AdvancedHelpPanel(getClass().getResource(path), this); } else { help = new JScrollPane(new HelpPanel(getClass().getResource(path), this).getPane()); } tabbedPane.addTab(help, title, Icons.getIcon("help")); }
public void nextTab() { int t = tabbedPane.getSelectedIndex(); t = (t + 1) % tabbedPane.getTabCount(); tabbedPane.setSelectedIndex(t); }