if ( p != null ) { p.button.setForeground(selectionForeground); p.button.setBackground(selectionBackground);
if (p != null)
    public void setSelectedIndex(int index) {        for ( int i=0; i<getTabCount(); i++ ) {            Page tab = getPageAt(i);            tab.button.setForeground(getForeground());            tab.button.setBackground(getBackground());            tab.setEnabled(i!=index);        }        model.setSelectedIndex(index);        Page p = getPageAt(index);        if ( p != null ) {            p.button.setForeground(selectionForeground);            p.button.setBackground(selectionBackground);            card.show(p.component);        }    }