@Override public void insertTab(String title, Icon icon, Component component, String tip, int index) { super.insertTab(title, icon, component, tip, index); if (!parentFrame.isTabCloseButtonEnabled()) return; MDITabTitle newComponent = new MDITabTitle(parentFrame, this, title, icon, component); setTabComponentAt(indexOfComponent(component), newComponent); }
/** Regular paint method from <code>Component</code> class. */ public void paint(Graphics g) { if (getTabCount() == 0) { // if there are no tabs in tabbed pane, draw a fillRect for // entire area of tabbed pane so as to reflect the background // that of the desktop pane which is used along with this tabbed // pane in MDIFrame class. g.setColor(parentFrame.getDektopPane().getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); } else { super.paint(g); } }