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