KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > actions > ZoomIn


1 /*
2  * Authors:
3  * Stefanovic Nenad chupo@iis.ns.ac.yu
4  * Bojanic Sasa sasaboy@neobee.net
5  * Puskas Vladimir vpuskas@eunet.yu
6  * Pilipovic Goran zboniek@uns.ac.yu
7  *
8  */

9
10 package org.enhydra.jawe.actions;
11
12 import org.enhydra.jawe.*;
13 import org.enhydra.jawe.xml.*;
14 import org.enhydra.jawe.xml.elements.*;
15 import org.enhydra.jawe.xml.panels.*;
16
17 import java.awt.Dimension JavaDoc;
18
19 import java.awt.event.ActionEvent JavaDoc;
20
21 /**
22  * Zoom in (for 15%)
23  */

24 public class ZoomIn extends ActionBase {
25
26    public ZoomIn (ProcessEditor pe) {
27       super(pe);
28    }
29
30    public void actionPerformed(ActionEvent JavaDoc e) {
31       //setResizeAction(null);
32
//editor.setScale(editor.getGraph().getScale()*1.15);
33
editor.setScale(editor.getGraph().getScale()/0.85); //Harald Meister: better "linear" zooming (also look in ZoomOut)
34
try {
35          Dimension JavaDoc prefSize=editor.getGraph().getSize();
36          prefSize.width=(int)(prefSize.width/0.85);
37          prefSize.height=(int)(prefSize.height/0.85);
38          editor.getGraph().setPreferredSize(prefSize);
39       } catch (Exception JavaDoc ex) {}
40
41       // With JGraph3.4.1 this causes problems
42
/*if (editor.getGraph().getSelectionCell() != null) {
43          editor.getGraph().scrollCellToVisible(editor.getGraph().getSelectionCell());
44        }*/

45    }
46 }
47
Popular Tags