session.grabFocus();
   public void addSessionView(String tabText,Session session) {      if (hideTabBar && sessionPane.getTabCount() == 0 && !embedded) {         this.getContentPane().add(session, BorderLayout.CENTER);         session.grabFocus();         session.resizeMe();         repaint();         if (packFrame)            pack();         else            validate();         embedded = true;      }      else {         if (hideTabBar && sessionPane.getTabCount() == 0 ) {            Session ses = null;            for (int x=0; x < this.getContentPane().getComponentCount(); x++) {               if (this.getContentPane().getComponent(x) instanceof Session) {                  ses = (Session)(this.getContentPane().getComponent(x));                  this.getContentPane().remove(x);                  break;               }            }            //ses = (Session)(this.getContentPane().getComponent(0));            sessionPane.addTab(tabText,focused,ses);            ses.grabFocus();            ses.resizeMe();            repaint();            if (ses.getAllocDeviceName() != null)               sessionPane.setTitleAt(0,ses.getAllocDeviceName());            else               sessionPane.setTitleAt(0,ses.getSessionName());            ses.addSessionListener(this);            ses.addSessionJumpListener(this);            this.getContentPane().add(sessionPane, BorderLayout.CENTER);         }         sessionPane.addTab(tabText,focused,session);         sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.black);         sessionPane.setIconAt(sessionPane.getSelectedIndex(),unfocused);         sessionPane.setSelectedIndex(sessionPane.getTabCount()-1);         sessionPane.setForegroundAt(sessionPane.getSelectedIndex(),Color.blue);         sessionPane.setIconAt(sessionPane.getSelectedIndex(),focused);         session.addSessionListener(this);         session.addSessionJumpListener(this);         session.grabFocus();         session.resizeMe();         session.repaint();      }   }