// remove the tabPane
tabPane = null;
removeAll();
if(firstSplitBorder!=null){
Element ef=getElement(firstSplitBorder.comp);
Component c=ef.owner;
if(tabSplit==c){
add(ef.border);
ef.owner=ef.border;
}
else{
add(c);
}
}
tabSplit = null;
}
} else if (e.owner == e.border) {
removeAll();
firstSplitBorder=null;
} else if (e.owner instanceof JSplitPane) {
JSplitPane sp = (JSplitPane) e.owner;
if ((sp.getLeftComponent() instanceof SplitBorder)
&& ((SplitBorder) (sp.getLeftComponent())).comp == e.comp) {
Component r=sp.getRightComponent();
if(sp.getParent() instanceof JSplitPane){
JSplitPane previous = (JSplitPane)sp.getParent();
sp.removeAll();
previous.setRightComponent(r);
if(r instanceof SplitBorder){
SplitBorder b=(SplitBorder)r;
Element eb=(Element)getElement(b.comp);
if(previous.getLeftComponent()==tabPane){
firstSplitBorder=b;
}
eb.owner=previous;
}
else if(r instanceof JSplitPane){
}
else {
throw new RuntimeException(
"SplitTabPane unexpected state : right component = "+r);
}
}
else if(sp.getParent()==this){
sp.removeAll();
removeAll();
add(r);
if(r instanceof SplitBorder){
SplitBorder b=(SplitBorder)r;
Element eb=(Element)getElement(b.comp);
eb.owner=b;
firstSplitBorder=b;
}
else if(r instanceof JSplitPane){
firstSplitBorder=(SplitBorder)((JSplitPane)r).getLeftComponent();
}
else {
throw new RuntimeException(
"SplitTabPane unexpected state : right component = "+r);
}
}
else{
throw new RuntimeException(
"SplitTabPane unexpected state : root split is not owned by this");
}
} else if ((sp.getRightComponent() instanceof SplitBorder)
&& ((SplitBorder) (sp.getRightComponent())).comp == e.comp) {
Component left = sp.getLeftComponent();
if (left instanceof JSplitPane) {
throw new RuntimeException(
"SplitTabPane unexpected state : left element is a split");
} else {
if (left == tabPane) {