01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.gui.swing;
17:
18: import java.awt.Cursor;
19: import java.awt.event.ActionEvent;
20: import java.net.URL;
21: import javax.swing.AbstractAction;
22: import javax.swing.Action;
23: import javax.swing.ImageIcon;
24:
25: /**
26: * @author ijt1
27: *
28: */
29: public class ZoomOutAction extends AbstractAction {
30: /**
31: * a simple zoom out action
32: */
33: private static final long serialVersionUID = 8669650422678543113L;
34: private ImageIcon icon;
35: JMapPane map;
36:
37: public ZoomOutAction(JMapPane map) {
38: URL url = this .getClass()
39: .getResource("resources/ZoomOut16.gif"); //$NON-NLS-1$
40: icon = new ImageIcon(url);
41: this .putValue(Action.SMALL_ICON, icon);
42: this .putValue(Action.NAME, Messages
43: .getString("ZoomOutAction.1")); //$NON-NLS-1$
44: this .map = map;
45: }
46:
47: public void actionPerformed(ActionEvent e) {
48:
49: map.setState(JMapPane.ZoomOut);
50: map.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
51: }
52: }
|