JDK-8160696 : IllegalArgumentException: adding a component to a container on a different GraphicsDevice
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u67
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-06-30
  • Updated: 2018-01-17
  • Resolved: 2016-08-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 7 JDK 8 JDK 9
7u131Fixed 8u131Fixed 9 b133Fixed
Related Reports
Duplicate :  
Relates :  
Description
In Java 7 and 8, when you move a Java application to different monitor and
add a Component to a Container on another graphics device, without explicitly
removing the Component from its previous parent, the application crashes:

java.lang.IllegalArgumentException: adding a container to a container on a
different GraphicsDevice
at java.awt.Component.checkGD(Unknown Source)
at java.awt.Container.checkGD(Unknown Source)
at java.awt.Container.checkGD(Unknown Source)
at java.awt.Container.checkGD(Unknown Source)
at java.awt.Container.addImpl(Unknown Source)
at javax.swing.JTabbedPane.insertTab(Unknown Source)
at javax.swing.JTabbedPane.addTab(Unknown Source)

See this NetBeans issue for more details and sample code to reproduce:
http://netbeans.org/bugzilla/show_bug.cgi?id=222051

A workaround is turning off Direct3D.

This issue does not occur with Java 6.