if (changeEvent.getState() == STATE_CONNECTED) { final String d = ses.getAllocDeviceName();  if (d != null) { final int index = frame.sessionPane.indexOfComponent(ses); Runnable tc = new Runnable () { public void run() { frame.sessionPane.setTitleAt(index,d); } }; SwingUtilities.invokeLater(tc);  }
switch (changeEvent.getState()) { case STATE_REMOVE: closeSession(ses); break;
   public void onSessionChanged(SessionChangeEvent changeEvent) {      Session ses = (Session)changeEvent.getSource();      System.out.println(changeEvent.getState() + " " +                        ses.getAllocDeviceName());      if (changeEvent.getState() == STATE_CONNECTED) {         final String d = ses.getAllocDeviceName();         if (d != null) {            final int index = frame.sessionPane.indexOfComponent(ses);            Runnable tc = new Runnable () {               public void run() {                  frame.sessionPane.setTitleAt(index,d);               }            };            SwingUtilities.invokeLater(tc);         }      }   }