public void minimiseAllWindows() {
   for (int i = 0; i < controllers.size(); i++) {
     SwingController controller = controllers.get(i);
     JFrame frame = controller.getViewerFrame();
     if (frame != null) frame.setState(Frame.ICONIFIED);
   }
 }
 public void bringWindowToFront(int index) {
   if (index >= 0 && index < controllers.size()) {
     SwingController controller = controllers.get(index);
     JFrame frame = controller.getViewerFrame();
     if (frame != null) {
       frame.setState(Frame.NORMAL);
       frame.toFront();
     }
   }
 }
 public void bringAllWindowsToFront(SwingController frontMost) {
   JFrame frontMostFrame = null;
   for (int i = 0; i < controllers.size(); i++) {
     SwingController controller = controllers.get(i);
     JFrame frame = controller.getViewerFrame();
     if (frame != null) {
       if (frontMost == controller) {
         frontMostFrame = frame;
         continue;
       }
       frame.setState(Frame.NORMAL);
       frame.toFront();
     }
   }
   if (frontMostFrame != null) {
     frontMostFrame.setState(Frame.NORMAL);
     frontMostFrame.toFront();
   }
 }