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 SelectAction extends AbstractAction {
26: private ImageIcon icon;
27: JMapPane map;
28:
29: public SelectAction(JMapPane map) {
30: URL url = this .getClass().getResource("resources/Add16.gif"); //$NON-NLS-1$
31:
32: icon = new ImageIcon(url);
33: this .putValue(Action.SMALL_ICON, icon);
34: this
35: .putValue(Action.NAME, Messages
36: .getString("SelectAction.1")); //$NON-NLS-1$
37: this .map = map;
38: }
39:
40: public void actionPerformed(ActionEvent e) {
41: // TODO Auto-generated method stub
42: map.setState(JMapPane.Select);
43: map.setCursor(new Cursor(Cursor.HAND_CURSOR));
44: }
45:
46: public ImageIcon getIcon() {
47: return icon;
48: }
49:
50: public void setIcon(ImageIcon icon) {
51: this.icon = icon;
52: }
53: }
|