I am developing on a Win2000 system using a 32mb ATI Radeon and the Java3D 1.3beta1
OpenGL implementation.
My application extends a Canvas3D object, which has been placed in a JPanel, which is
in a JFrame. In my Canvas3D class, I have subclassed the postRender() method as
follows:
public void postRender()
{
J3DGraphics2D vGraphics = super.getGraphics2D();
vGraphics.setFont(new Font("sans-serif", Font.PLAIN, 16));
vGraphics.setPaint(mColor);
vGraphics.drawString(mText, 50, 50);
vGraphics.flush(false);
}
On occasion, the variable 'mText' is set to an empty string (""), so that nothing is
drawn. When this happens, the following exception is thrown:
Exception occurred during Canvas3D callback:
java.lang.IllegalArgumentException: Zero length string passed to TextLayout
constructor.
at java.awt.font.TextLayout.<init>(Unknown Source)
at javax.media.j3d.J3DGraphics2DImpl.drawString(J3DGraphics2DImpl.java:676)
at javax.media.j3d.J3DGraphics2DImpl.drawString(J3DGraphics2DImpl.java:689)
at CaptureCanvas3d.postRender(CaptureCanvas3d.java:136)
at javax.media.j3d.Renderer.doWork(Renderer.java:1219)
at javax.media.j3d.J3dThread.run(J3dThread.java:256)
An exception is not thrown when this code is used in a normal, Graphics2D context in a
Swing application without a Canvas3D. Is this just a change in implementation that has
not been documented or a bug?
Thanks for any insight,
Sean
==========================================================================To
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".