Hi all,
Tom Whittaker wrote:
>
> 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.
That's what exactly what I do and it looks fine.
Use a BorderLayout, put, the display in the CENTER, put a JLabel or,
even better, a JTextField (as it is editable) at NORTH. It saves one
from having to deal with all that DataReference stuff and from having to
use code to draw non-rotating text. Not to mention this trouble with
drawString() onto some Canvas.
As Tom says, the only drawback is the back/foreground color. When
changing the display color, you have to remember to tell you computer to
do the same for the JLabel/JTextField. Another little problem is when
saving the display as a JPG. you can't "captureDisplay()" anymore, but
have to write your own code do do so. Which isn't difficult. Let us know
in case you want more details.
Cheers,
Ugo