Heavyweight Internal Frames : Java 3D Sample.
as of the JRE 6 Update 12 release mixing heavyweight and lightweight components works almost perfectly. JInternalFrames with a heavyweight content are now supported.
To test this new capability I wrote the Java 3D sample program PropellerUniverse:
- Canvas3D objects (java.awt.Canvas) are added to JInternalFrame objects. They render simultaneously four views into an animated 3D scene.
- One Canvas3D object fills the entire desktop pane as a background.
- The other three frames can be maximized and minimized as well as dragged and resized in outline or live mode.
- Controls are added to another internal frame which is in the palette-layer and can be dragged in live mode.
- While dragging or resizing a frame in outline mode four line-panels are set visible in the drag-layer.
- Two layouts, Discret and Overlap, can be selected to locate the Canvas3Ds and the control panel. The chosen layout remains effected until a Canvas3D is dragged or resized.
- A subclass of MetalInternalFrameUI is put into the UIManager to remove the standard title bar. A virtual title bar is implemented which allows to drag an internal frame with the left mouse button and to maximize/minimize it by a double click of the left mouse button.
- A context menu (JPopupMenu) is shown on top of an internal frame when the right mouse button is clicked. This menu allows to reset the viewpoint, to toggle between windowed and simulated full-screen mode, and to exit the application.
Issues / wish list:
- A heavyweight content is not shown through a transparent glass pane or a transparent internal frame.
- The standard outline is not drawn on heavyweight content.
This sample program can be run per Java Web Start and as a JApplet. Sources are available for download. http://www.interactivemesh.org/testspace/j3dmeetsswing.html
Latest articles about 'Mixing Heavyweight and Lightweight Components'
Message was edited by: interactivemesh