blob: 1c35ba0456230afca182a49628cd513f82635c88 [file] [log] [blame]
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
= How to mix lightweight (Swing) and heavyweight (AWT) components?
:page-layout: wikidev
:page-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqMixingLightweightHeavyweight
:description: Apache NetBeans wiki DevFaqMixingLightweightHeavyweight
:toc: left
:toc-title:
:page-syntax: true
:page-wikidevsection: _window_system
:page-position: 25
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:
[source,java]
----
-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:
[source,java]
----
-J-Dsun.awt.disableMixing=false
----
For reference, see link:http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/awt.html[Oracle Notes on AWT]
Applies to: NetBeans 7.3 and above