Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160696

IllegalArgumentException: adding a component to a container on a different GraphicsDevice

XMLWordPrintable

    • b133


        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.

              mcherkas Mikhail Cherkasov (Inactive)
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: