/** Closes a tab.
* @param source The source of the event. */
private static void closeTab(Object source)
{
ClosableTab tab = null;
if (source instanceof ClosableTab)
{
tab = (ClosableTab) source;
}
else
{
tab = (ClosableTab) ((JComponent) source).getParent();
}
Component c = Hierarchy.findDirectAncestor(JTabbedPane.class, tab);
JTabbedPane jtp = (JTabbedPane) c;
jtp.remove(tab.getIndex());
}