if (frames[idx].getContentPane().equals(session)) {
Session ses = (Session)frames[idx].getContentPane(); if (ses.equals(session)) {
   public int getIndexOfSession(Session session) {      JInternalFrame[] frames = (JInternalFrame[])desktop.getAllFrames();      int index = -1;      for (int idx = 0; idx < frames.length; idx++) {         if (frames[idx].getContentPane().equals(session)) {            index = idx;            return index;         }      }      return index;   }