KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $RCSfile: TileWindowsHorizontalAction.java,v $
3  * @modification $Date: 2001/09/28 19:31:19 $
4  * @version $Id: TileWindowsHorizontalAction.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 horizontal 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: TileWindowsHorizontalAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
25  */

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

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

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