private static void switchTo(String tabName) { try { container.setSelectedIndex(container.indexOfTab(tabName)); Tab tab = (Tab) container.getSelectedComponent(); tab.refresh(); } catch (IndexOutOfBoundsException e) { System.err.println("Tab selection index out of bound."); e.printStackTrace(); } }
private static void addTab(String tabName, JPanel panel) { container.addTab(tabName, panel); panel.setName(tabName); int index = container.indexOfTab(tabName); container.setToolTipTextAt(index, tabName); container.setSelectedIndex(index, true); container.setIconAt( index, new ImageIcon(FramePropertyLoader.getImageIcon("tabIcon").getImage())); resizeTab(MainRoboOfficeJFrame.getInstance().getWidth()); // tabTable.put(tabName,index); Tab currentTab = (Tab) panel; currentTab.setFocus(); }