I'm not sure if this is what you are asking for, but it worked for me:
final WorldWindowGLCanvas aCanvas = new WorldWindowGLCanvas(); aCanvas.setModel(new BasicModel()); aCanvas.getInputHandler().addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent pE) { Position aCurrentPosition = aCanvas.getCurrentPosition(); //Or whatever work: if(aCurrentPosition != null) { System.out.println("Current Pos= " + aCurrentPosition); } else { System.out.println("Current Pos is null!"); } } });
I added a null check to see if it will ever get null, and that is not the case. The assumption that this code makes is that clicking the mouse will block the globe to this position. Calling aCanvas.getCurrentPosition () should return the center of the globe. If the canvas is not displayed or not displayed, then this method returns null.
source share