TileWindowsHorizontalAction.java :  » Installer » VAInstall » com » memoire » vainstall » builder » action » Java Open Source

Java Open Source » Installer » VAInstall 
VAInstall » com » memoire » vainstall » builder » action » TileWindowsHorizontalAction.java
/*
 * $RCSfile: TileWindowsHorizontalAction.java,v $
 * @modification $Date: 2001/09/28 19:31:19 $
 * @version      $Id: TileWindowsHorizontalAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
 *
 */

package com.memoire.vainstall.builder.action;

import com.memoire.vainstall.builder.*;
import com.memoire.vainstall.builder.gui.*;

import java.awt.Rectangle;

import javax.swing.*;

/**
 * This action tiles all internal frames horizontal on the desktop pane
 * that is not iconified.
 *
 * @see com.memoire.vainstall.builder.util.AbstractVAIBuilderAction
 *
 * @author Henrik Falk
 * @version $Id: TileWindowsHorizontalAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
 */
public class TileWindowsHorizontalAction extends AbstractVAIBuilderAction {

    /**
     * Default constructor
     */
    public TileWindowsHorizontalAction() {
        super();
    }

    /**
     * Implements the runnit method
     */
    public void runnit() {
        JDesktopPane pane = ((VAIBuilderFrame)getController().getFrame()).getDesktopPane();

        JInternalFrame iframes[] = pane.getAllFrames();

        int activeCount = 0;
        for (int i = 0; i < iframes.length; i++) {
            if (iframes[i].isIcon() == false) {
                activeCount++;
            }
        }

        JInternalFrame[] activeFrames = new JInternalFrame[activeCount];

        activeCount = 0;
        for (int i = 0; i < iframes.length; i++) {
          if (iframes[i].isIcon() == false) {
              activeFrames[activeCount] = iframes[i];
              activeCount++;
          }
        }

        for(int i=0;i<activeCount;i++) {
            activeFrames[i].setBounds(0,i*(pane.getHeight()/activeCount),pane.getWidth(),pane.getHeight()/activeCount);
        }

    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.