This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 222051 - Docking a window from another screen produces an exception when using jre 1.7
Summary: Docking a window from another screen produces an exception when using jre 1.7
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: JDK Problems (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Stanislav Aubrecht
URL: http://bugs.sun.com/bugdatabase/view_...
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-13 14:46 UTC by barta
Modified: 2013-03-15 17:54 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Contains a simple Netbeans module illustrating the problem in Netbeans, as well as a simple java class that illustrates this using awt/swing code only. (11.57 KB, application/zip)
2012-11-13 14:46 UTC, barta
Details

Note You need to log in before you can comment on or make changes to this bug.
Description barta 2012-11-13 14:46:45 UTC
Created attachment 127728 [details]
Contains a simple Netbeans module illustrating the problem in Netbeans, as well as a simple java class that illustrates this using awt/swing code only.

On a dual screen setup, an IllegalArgumentException can be thrown in Netbeans during following scenario when using jre 1.7 (any version)

- undock a window and move it to the other screen
- dock the window

--> IllegalArgumentException: adding a container to a container on a different GraphicsDevice


This is a bug in java 1.7 and happens when you add a Component to a Container on another graphics device, without explicitly removing the Component from its previous parent.

I've attached a simple Netbeans module that illustrates the problem. When ran, you can create a Canvas by going to Windows -> Canvas. Undocking this Canvas, moving to another screen, and re-docking illustrates the bug.

I've also attached a simple java class that illustrates this is a jre 1.7 bug.

Workaround:

Call component.getParent().remove(component) before calling container.add(component).

This issue does not occur when using java 1.6.
Comment 1 Stanislav Aubrecht 2012-11-14 09:08:33 UTC
Thanks for the detailed steps to reproduce. Please provide also your JDK version number so that I can file the bug to JDK team.
Comment 2 barta 2012-11-14 09:31:07 UTC
Reproduced on:

java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) Server VM (build 23.3-b01, mixed mode)


And on:

java version "1.7.0_10-ea"
Java(TM) SE Runtime Environment (build 1.7.0_10-ea-b15)
Java HotSpot(TM) Server VM (build 23.6-b04, mixed mode)


Thanks for looking into this.