KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > memoire > vainstall > builder > action > CascadeWindowsAction


1 /*
2  * $RCSfile: CascadeWindowsAction.java,v $
3  * @modification $Date: 2001/09/28 19:31:19 $
4  * @version $Id: CascadeWindowsAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
5  *
6  */

7
8 package com.memoire.vainstall.builder.action;
9
10 import com.memoire.vainstall.builder.*;
11 import com.memoire.vainstall.builder.gui.*;
12
13 import java.awt.Rectangle JavaDoc;
14
15 import javax.swing.*;
16
17 /**
18  * This action cascades all internal frames on the desktop pane
19  * that is not iconified.
20  *
21  * @see com.memoire.vainstall.builder.util.AbstractVAIBuilderAction
22  * @see javax.swing.JDesktopPane
23  *
24  * @author Henrik Falk
25  * @version $Id: CascadeWindowsAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
26  */

27 public class CascadeWindowsAction extends AbstractVAIBuilderAction {
28
29     /**
30      * Default constructor
31      */

32     public CascadeWindowsAction() {
33         super();
34     }
35
36     /**
37      * Implements the runnit method
38      */

39     public void runnit() {
40
41         JDesktopPane pane = ((VAIBuilderFrame)getController().getFrame()).getDesktopPane();
42
43         JInternalFrame iframes[] = pane.getAllFrames();
44
45         int activeCount = 0;
46         for (int i = 0; i < iframes.length; i++) {
47             if (iframes[i].isIcon() == false) {
48                 activeCount++;
49             }
50         }
51
52         JInternalFrame[] activeFrames = new JInternalFrame[activeCount];
53
54         activeCount = 0;
55         for (int i = 0; i < iframes.length; i++) {
56             if (iframes[i].isIcon() == false) {
57                 activeFrames[activeCount] = iframes[i];
58                 activeCount++;
59             }
60         }
61
62         int down = activeCount-1;
63
64         for (int i = 0; i < activeCount; i++) {
65             activeFrames[i].setBounds(down*40,down*40,activeFrames[i].getWidth(),activeFrames[i].getHeight());
66             down--;
67         }
68
69     }
70
71 }
72
Popular Tags