|
Glass - Java3D Psuedo Transaprent Window hack
Java GUI API's (AWT/SWING) or Java3D does not provide transparent windows or shaped windows like other platform specfic API's like X/Motif or MS Windows API. Here is a hack for a psuedo transaprent window using Java Robot API to do a screen capture and using it as the background on the Java 3D wiew on a JWindow created without any window decorations. How does it work1. Use Robot API and do a screen capture and store it into a BufferedImage2. Extend JWindow override paint() and update() 3. Create a Canvas3D with default GraphicsConfiguration 4. Add the Canvas3D to the Content Pane of JWindow created in Step 2 5. Create a Java3D Scene Graph with the BufferedImage captured by Robot in Step 1 as the background texture. 6. Create a SimpleUniverse with Canvas3D from Step 3 and Scene Graph from Step 5 Run the demoTo run this demo, You should have JDK 1.4.x and Java3D.Get the codeView Glass.javaDownload Glass.java
|
| Saturday, 19-Mar-2005 08:28:07 PST | kishan at hackorama dot com |


