There are two important requirements you need to know before start using SwingAnnotation:
- You need JDK6u12 (which currently is in early access). JDK6u12 solves the problem between heavyweight and lighweight component, this way we can put JPanel on top of a Canvas component without problems.
- The container on which the WWJ Canvas resides must use a null layout:
wwd = new WorldWindowGLCanvas();
wwd.setSize(new java.awt.Dimension(600, 500));
The JPanel of the SwingAnnotations share the same container as the WWJ canvas. This is the reason you need to set the layout to null, to allow place the panels at any location.
You can get the source code here.