if (index == 0) {  try { frames[frames.length - 1].setSelected(true); frames[frames.length - 1].repaint(); selectedIndex = frames.length -1; } catch (java.beans.PropertyVetoException e) { System.out.println(e.getMessage());
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);     if (mix.equals(mif)) { index = x - 1; break;
   private void prevSession() {      JInternalFrame[] frames = (JInternalFrame[])desktop.getAllFrames();      JInternalFrame miv = (JInternalFrame)desktop.getSelectedFrame();//      int index = desktop.getIndexOf(miv);      int index = selectedIndex;      if (index == 0) {//         desktop.setSelectedFrame(frames[frames.length - 1]);         try {            frames[frames.length - 1].setSelected(true);            frames[frames.length - 1].repaint();            selectedIndex = frames.length -1;         }         catch (java.beans.PropertyVetoException e) {            System.out.println(e.getMessage());         }      }      else {         try {            frames[index - 1].setSelected(true);            frames[index - 1].repaint();            selectedIndex--;         }         catch (java.beans.PropertyVetoException e) {            System.out.println(e.getMessage());         }      }   }