KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $RCSfile: TileWindowsVerticalAction.java,v $
3  * @modification $Date: 2001/09/28 19:31:19 $
4  * @version $Id: TileWindowsVerticalAction.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 tiles all internal frames vertical on the desktop pane
19  * that is not iconified.
20  *
21  * @see com.memoire.vainstall.builder.util.AbstractVAIBuilderAction
22  *
23  * @author Henrik Falk
24  * @version $Id: TileWindowsVerticalAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
25  */

26 public class TileWindowsVerticalAction extends AbstractVAIBuilderAction {
27
28     /**
29      * Default constructor
30      */

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

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