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));
this.getContentPane().setLayout(null);
this.getContentPane().add(wwd);
...
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.
11 comments:
good to know that it is now working with 6u12. I did similar things (null layout + add to parent) in past but it was far more hacky since event re-dispatching and paint to texture was also involved.
I am currently using Scenarios embedded toolkit with custom peers which is a cleaner solution compared to my first and allows to position components in 3d. I really should re-investigate the whole issue from the 6u12 POV ;-).
Excellent!, Do you know if is possible to use SWT to do the same? I'm using WWJ inside eclipse and I would like to be able to use my SWT controls as annotations
thank you
Sorry but I don't know.
Take a look at GeoWind project which is developed with Eclipse RCP: http://geowind.javaforge.com/
excellent work !
the link for your code is broken. is it possible to correct it ?
thanks !
Thanks a lot Bruno.
I upload my code to googlepages. Unfortunately google is going to set down that project. I'm in the phase to move this blog and source to other place.
Ok thanks !
I'm waiting eagerly for your update !
My project is becoming more and more official. As a consequence, I'm more impatient to show what can be done with WWJ in order to get credits.
Would it be possible that you send me the code relative to SwingAnnotations ?
Thanks in advance !
Hi Bruno,
could you tell me more about your project?
Is it OpenSource? Which technologies do you use?
Maybe we can cooperate.
PD: You can contact with me at 'asantiagop(->at<-)gmail(->dot<-).com'.
Hola santiago, h estado miranod tu blog un bune rato y tienes cosas muy itneresantes, actualmente trabajo en un poryecto comercial, peor nefocado a open source, si es posible contactame en gato . climber @ gmail . com a ver si es posible q cooperemos...mil gracias!!!
May I get the source code of this swing annotation please .
Take a look into the repository: https://github.com/acanimal/WWJ
Post a Comment