/[schmitzm]/trunk/src/skrueger/geotools/CrsLabel.java
ViewVC logotype

Contents of /trunk/src/skrueger/geotools/CrsLabel.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1222 - (show annotations)
Wed Nov 3 14:07:08 2010 UTC (14 years, 3 months ago) by alfonx
File MIME type: text/plain
File size: 1120 byte(s)
Added a label for the CRS to the MapPaneStatusBar
1 package skrueger.geotools;
2
3 import javax.swing.JLabel;
4
5 import schmitzm.geotools.gui.GeotoolsGUIUtil;
6 import schmitzm.geotools.gui.SelectableXMapPane;
7 import schmitzm.geotools.gui.XMapPaneEvent;
8 import schmitzm.geotools.map.event.JMapPaneListener;
9
10 public class CrsLabel extends JLabel {
11
12 private JMapPaneListener listenForCrsChange = new JMapPaneListener() {
13
14 @Override
15 public void performMapPaneEvent(XMapPaneEvent e) {
16 updateCrs();
17 }
18 };
19
20 private final SelectableXMapPane mapPane;
21
22 public CrsLabel(SelectableXMapPane mapPane) {
23 super();
24 this.mapPane = mapPane;
25
26 mapPane.addMapPaneListener(listenForCrsChange);
27
28 updateCrs();
29
30 setToolTipText(GeotoolsGUIUtil.R("CRSLabel.TT"));
31 }
32
33 public void updateCrs() {
34 String crsName = "";
35 try {
36 crsName = mapPane.getMapContext().getCoordinateReferenceSystem()
37 .getName().toString();
38 setText(GeotoolsGUIUtil.R("CRSLabel", crsName));
39 } catch (Exception e) {
40 setText("");
41 }
42 }
43
44 @Override
45 protected void finalize() throws Throwable {
46 super.finalize();
47 if (mapPane != null)
48 mapPane.removeMapPaneListener(listenForCrsChange);
49 }
50
51 }

Properties

Name Value
svn:eol-style native
svn:keywords Id URL
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26