ActZoomIn.java :  » Swing-Library » swingexplorer » org » swingexplorer » Java Open Source

Java Open Source » Swing Library » swingexplorer 
swingexplorer » org » swingexplorer » ActZoomIn.java
/*
 * Swing Explorer. Tool for developers exploring Java/Swing-based application internals. 
 * Copyright (C) 2008, Maxim Zakharenkov
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 * 
 * $Header: /cvs/swingexplorer/src/org/swingexplorer/ActZoomIn.java,v 1.2 2008/02/06 08:36:08 maxz1 Exp $
 */
package org.swingexplorer;

import java.awt.event.ActionEvent;

/**
 * 
 * @author Maxim Zakharenkov
 */
public class ActZoomIn extends RichAction {

  MdlSwingExplorer model;
  
  public ActZoomIn(MdlSwingExplorer modelP) {
    setName("Zoom In");
    setTooltip("Zoom In");
        setIcon("zoom_in.png");
        model = modelP;
  }
  public void actionPerformed(ActionEvent e) {
    // 
    double curScale = model.getDisplayScale();
    
    // calculate scale closest to 25*N
    int normalScale = ((int)(curScale*100))/25;
    normalScale = normalScale * 25  + 25;
    
    model.setDisplayScale(((double)normalScale)/100);
  }
}

/*
 * $Log: ActZoomIn.java,v $
 * Revision 1.2  2008/02/06 08:36:08  maxz1
 * Changed license header
 *
 * Revision 1.1  2007/06/27 19:41:38  maxz1
 * new
 *
 */
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.