try { ((MyInternalFrame)myFrameList.get(index)).setSelected(true); } catch (java.beans.PropertyVetoException e) { System.out.println(e.getMessage()); }
   private void nextSession() {      JInternalFrame[] frames = (JInternalFrame[])desktop.getAllFrames();      JInternalFrame miv = desktop.getSelectedFrame();      int index = desktop.getIndexOf(miv);      MyInternalFrame mix = (MyInternalFrame)frames[index];      int seq = mix.getInternalId();      index  = 0;      for (int x = 0; x < frames.length; x++){         MyInternalFrame mif = (MyInternalFrame)frames[x];         System.out.println(" current index " + x + " count " + frames.length + " has focus " +                        mif.isActive() + " title " + mif.getTitle());         if (mif.getInternalId() > seq) {            index = x;            break;         }      }      System.out.println(" current index " + index + " count " + desktop.getComponentCount());      if (index < desktop.getComponentCount() - 1) {         try {            frames[index].setSelected(true);         }         catch (java.beans.PropertyVetoException e) {            System.out.println(e.getMessage());         }      }      else {         try {            frames[0].setSelected(true);         }         catch (java.beans.PropertyVetoException e) {            System.out.println(e.getMessage());         }      }   }