private void resetTabbedPane(){
  ArrayList<SearchResultMediator> ents=new ArrayList<>();
  ArrayList<Component> tabs=new ArrayList<>();
  ArrayList<String> titles=new ArrayList<>();
  for (int i=0; i < tabbedPane.getTabCount() && i < entries.size(); ++i) {
    tabs.add(tabbedPane.getComponent(i));
    titles.add(tabbedPane.getTitleAt(i));
    ents.add(entries.get(i));
  }
  tabbedPane.removeAll();
  entries.clear();
  setupTabbedPane();
  for (int i=0; i < tabs.size(); ++i) {
    entries.add(ents.get(i));
    tabbedPane.addTab(titles.get(i),tabs.get(i));
  }
}

private void resetTabbedPane ( ) { ArrayList < SearchResultMediator > ents = new ArrayList < > ( ) ; ArrayList < Component > tabs = new ArrayList < > ( ) ; ArrayList < String > titles = new ArrayList < > ( ) ; for ( int i = 0 ; i < tabbedPane . getTabCount ( ) && i < entries . size ( ) ; ++ i ) { tabs . add ( tabbedPane . getComponent ( i ) ) ; titles . add ( tabbedPane . getTitleAt ( i ) ) ; ents . add ( entries . get ( i ) ) ; } tabbedPane . removeAll ( ) ; entries . clear ( ) ; setupTabbedPane ( ) ; for ( int i = 0 ; i < tabs . size ( ) ; ++ i ) { entries . add ( ents . get ( i ) ) ; tabbedPane . addTab ( titles . get ( i ) , tabs . get ( i ) ) ; } }
when a problem occurs with the jtabbedpane , we can reset it ( and hopefully circumvent the problem ) . we first get all of the components and their respective titles from the current tabbed pane , create a new tabbed pane and add all of the components and titles back in .
