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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1220 - (hide annotations)
Wed Nov 3 13:09:32 2010 UTC (14 years, 3 months ago) by alfonx
File MIME type: text/plain
File size: 939 byte(s)


1 alfonx 1220 package skrueger.geotools;
2    
3     import javax.swing.JLabel;
4    
5     import schmitzm.geotools.gui.SelectableXMapPane;
6     import schmitzm.geotools.gui.XMapPaneEvent;
7     import schmitzm.geotools.map.event.JMapPaneListener;
8    
9     public class CrsLabel extends JLabel {
10    
11     private JMapPaneListener listenForCrsChange = new JMapPaneListener() {
12    
13     @Override
14     public void performMapPaneEvent(XMapPaneEvent e) {
15     updateCrs();
16     }
17     };
18    
19     private final SelectableXMapPane mapPane;
20    
21     CrsLabel(SelectableXMapPane mapPane) {
22     super();
23     this.mapPane = mapPane;
24    
25     mapPane.addMapPaneListener(listenForCrsChange);
26    
27     updateCrs();
28     }
29    
30     public void updateCrs() {
31     try {
32     setText(mapPane.getMapContext().getCoordinateReferenceSystem()
33     .getName().toString());
34     } catch (Exception e) {
35     setText("");
36     }
37     }
38    
39     @Override
40     protected void finalize() throws Throwable {
41     super.finalize();
42     if (mapPane != null)
43     mapPane.removeMapPaneListener(listenForCrsChange);
44     }
45    
46     }

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