Well, I could be wrong, but...since your VisADCanvasJ3D 'canvas' extends
java.awt.Canvas (a few levels deep...), it might work the same way: when
you get the graphics context for the Canvas and drawString() onto it, you
may trigger a call to that Canvas' paint() method...which just might
obliterate whatever you just drew into it.
Perhaps a different approach would be to imbed the VisAD Display into your
own frame, leaving some room for a label inside the frame. Using the same
background color would give the effect of being part of the Display, and
have the added benefit of not getting blocked out by any of the VisAD
'box' contents.
tom
On 25 Jun 2002, Mike Charters wrote:
> How can I add (non-rotating) text to a VisAD DisplayImplJ3D?
>
> I have been trying to do this using some modified code that I found on
> the VisAD list. Here is the code:
>
> DisplayRendererJ3D dr
> (DisplayRendererJ3D)display.getDisplayRenderer();
> VisADCanvasJ3D canvas = dr.getCanvas();
> J3DGraphics2D g2d = canvas.getGraphics2D();
> g2d.drawString("My title",50,50);
>
> This code compiles and everything... but it does not put anything on the
> display... is there something i need to do after adding the text to
> actually update the visAD display?
>
> Thanks,
> -Mike
>
>
--
Tom Whittaker
University of Wisconsin-Madison
Space Science and Eng. Center
ph: 608.262.2759