How to mix lightweight (Swing) and heavyweight (AWT) components?

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

Since JDK 6 update 12 and JDK 7, support for mixing of AWT (heavyweight, native widgets) and Swing (lightweight, pure Java widgets) is available and usually works quite well. However, placing a native AWT Component within a Swing container hierarchy with customizations may cause unwanted side-effects and can therefor be disabled.

As of NetBeans 7.3, an additional option has been added to etc/netbeans.conf to disable mixing by default:

-J-Dsun.awt.disableMixing=true

In some cases, such as displaying OpenGL content via JOGL, it may be necessary to add a native component to a NetBeans TopComponent. In that case, the default setting breaks usability of the platform application by incorrectly drawing menus and other lightweight components behind the native component. To re-enable the mixing, the above option needs to be set to false:

-J-Dsun.awt.disableMixing=false

For reference, see Oracle Notes on AWT

Applies to: NetBeans 7.3 and above