When Java3D is used in a TopComponent, repaint time in any other TopComponent is extremely slow. This is only an issue with a Netbeans Platform application on a Mac computer and has not been observed on Windows 7.
A simple test case is attached.
1. Create a new NetBeans Platform application.
2. Add a new module, and add a new window called Window2D. Add a JPanel with some 2D graphics (see attached file for Window2DTopComponent.java which includes class EditPanel). Clicking the mouse within the panel causes 100 small circles to be drawn.
3. Add a new module, and add a new window called Window3D. Add a JPanel with some 3D graphics (see attached file for Window3DTopComponent.java which includes class Basic3DPanel). This panel shows a single 3D cube.
When Window3D is open, click anywhere in Window2D which causes a repaint() at the clicked location. The repaint time is extremely slow (about a second to draw 100 little circles). Close Window3D, and the repaint time is normal (i.e. very fast). The problem is observed under NetBeans 6.9.1 and under NetBeans 7.0 Beta (Build 201011152355). In a real program, graphics response in any other window is intolerably slow whenever a 3D window is open.
This problem has been observed on a desktop Mac Pro (2.66Hz Quad core) with repaint times of about 1 second for 100 2D shapes in a window. Also observed on a MacBook Pro. Both running OS X 10.6.6 with latest software updates and latest Java. It did not occur when the test case was running on Windows 7 (bootcamp on the same Mac Pro computer). This indicates a MacOSX-only problem.
The simple test case was also run using JFrames (i.e. not running on the NetBeans platform) and there was no problem. This indicates a NetBeans Platform issue, not a generic Java/Java3D/Mac problem.
Note: Windows users will have to encapsulate the Java3d .jar files in a Library Wrapper Module. (This is not required on Mac's because Java 3D is already part of the system).
I did answer this on the mailing list that setting -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true is needed to speed up the graphics on Mac and that fixed it.
closing as invalid - see the last comment
nicklas, thanks for the tip!
Thank you. That works.