Skip to main content

Heavyweight Internal Frames : Java 3D Sample.

6 replies [Last post]
interactivemesh
Offline
Joined: 2006-06-07

Hi,

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'
- http://java.sun.com/developer/technicalArticles/GUI/mixing_components/in...
- http://today.java.net/article/2009/11/02/transparent-panel-mixing-heavyw...

August

Message was edited by: interactivemesh

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
interactivemesh
Offline
Joined: 2006-06-07

[b]Mixing fails on JDK 1.7.0_ea-b76 (Milestone 5) !![/b]

Anthony,

on Windows XP / 7 RC 32-bit the Canvas3D objects (java.awt.Canvas) aren't rendered anymore. The PropellerUniverse application runs fine, no exception is thrown, but all internal frames are rendered only in gray color. I prepared a zip-file for download which contains all required archives to run PropellerUniverse locally per propellerUniverse1.0.bat on systems with Java 3D installed: http://www.interactivemesh.org/off/propellerUniverse1.0bin.zip

Even a simple application in which the Canvas3D object fills the entire JFrame doesn't render the heavyweight canvas.

August

Update: 2009/11/16

I don't know which was the last properly working release. My oldest releases available are b71 and b72.

JDK 1.7.0_ea-b72 shows the identical effect as b76: the background color of the lightweight parent is painted.

JDK 1.7.0_ea-b71 toggles between the heavyweight Canvas3D scene and the background color of the lightweight parent when the frame or the internal frame is repainted due to 'toFront' or resizing.

Message was edited by: interactivemesh

anthony_p
Offline
Joined: 2006-07-24

Hi August,

You may be missing some significant mixing-related enhancements and bug-fixes that have not been integrated yet. Notably, the fixes for 6885735 and 6852592 (see them on bugs.sun.com).

With these fixes applied the mixing-related tests do not fail. Please wait for the next build of jdk7 (b77 or b78 - I don't exactly know to what build the AWT fixes are going to be integrated) and see how it works then.

--
best regards,
Anthony

sproketboy
Offline
Joined: 2006-08-07

Cool. Thanks for the info!

anthony_p
Offline
Joined: 2006-07-24

Hi August,

> - A heavyweight content is not shown through a transparent glass pane or a transparent internal frame.

The current implementation of the hw/lw mixing feature does not support transparent lw components. That is unlikely to change in the near term. If you wish to display some non-transparent parts of the glass pane, you might want to set the mixing cut-out shape to the glass pane in order to make the rest of the pane transparent. The article describes the API for that purpose.

> - The standard outline is not drawn on heavyweight content.

I think you can only use the simple mode for dragging internal frames. All other modes use painting optimizations which are not supported by the hw/lw mixing code at all.

--
best regards,
Anthony

interactivemesh
Offline
Joined: 2006-06-07

Anthony,

the 'mixing-cutout' feature as described in the article worked fine in two test cases:

- all fillers in the control panel could be eliminated, so that an underlying panel was to be seen
- the outline of a dragged or resized internal panel could be painted into the glass pane (graphics.drawRect())

Unfortunately, a moving outline also generates flickering similar to my line-panels.

Thanks, August

anthony_p
Offline
Joined: 2006-07-24

Well, perhaps drawing first, then re-applying the cutout shape might smooth the things up a little, instead of re-applying-then-drawing? There's no any means of synchronization exist actually, so small flickering is going to be noticible with the "manual drawing" approach.