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: public class ZoomInAction extends AbstractAction {
26: /**
27: * a simple zoom in action
28: */
29: private static final long serialVersionUID = 5757407203303739037L;
30: private ImageIcon icon;
31: JMapPane map;
32:
33: public ZoomInAction(JMapPane map) {
34: URL url = this .getClass().getResource("resources/ZoomIn16.gif"); //$NON-NLS-1$
35: icon = new ImageIcon(url);
36: this .putValue(Action.SMALL_ICON, icon);
37: this
38: .putValue(Action.NAME, Messages
39: .getString("ZoomInAction.1")); //$NON-NLS-1$
40:
41: this .map = map;
42: }
43:
44: public void actionPerformed(ActionEvent e) {
45: // TODO Auto-generated method stub
46: map.setState(JMapPane.ZoomIn);
47: map.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
48: }
49:
50: public ImageIcon getIcon() {
51: return icon;
52: }
53:
54: public void setIcon(ImageIcon icon) {
55: this.icon = icon;
56: }
57: }
|