package uk.ac.leeds.ccg.geotools; import java.awt.*; import java.io.*; import java.awt.event.*; public class XYDisplay extends Panel implements MouseMotionListener, MouseListener,Serializable{ Label x; Label y; public Dimension pd; String s; int dp=2; boolean showProjected = false; public XYDisplay(Viewer view){ this(); view.addMouseMotionListener(this); } public XYDisplay(){ super(); setLayout(new GridLayout(1,2)); x=new Label("00000000",Label.RIGHT); x.setText("00000000"); y=new Label("00000000",Label.RIGHT); setSize(205,22); //x.setSize(100,x.getSize().height); //y.setSize(100,y.getSize().height); add(x); add(y); pd=new Dimension(210,x.getSize().height); } //public Dimension getPreferredSize(){ //System.out.println("Asked for pref "+pd); //System.out.println("X "+x.getSize()); //pd=new Dimension(210,x.getSize().height); //return pd; //} //public Dimension getMinimumSize(){ //System.out.println("Asked for min "+pd); //pd=new Dimension(210,x.getSize().height); //return pd; //} public final void mouseDragged(MouseEvent e){} public final void mouseMoved(MouseEvent e){ double p[]; if(showProjected==false){ p= ((Viewer)e.getSource()).getMapPoint(); }else{ p= ((Viewer)e.getSource()).getProjPoint(); } {s=(new Double(p[0])).toString(); int i = s.lastIndexOf('.'); if(i!=-1&&dp>0){ String dec; if((i+dp+1)0){ String dec; if((i+dp+1)