Apache NetBeans Wiki Index

Note: These pages are being reviewed.

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

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

<hr/> Applies to: NetBeans 7.3 and above

Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqMixingLightweightHeavyweight , that was last modified by NetBeans user Nhoffmann on 2013-02-26T14:08:59Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.