java-native-access/jna · error · IllegalArgumentException

Window GraphicsConfiguration '" +…

Error message

Window GraphicsConfiguration '" + w.getGraphicsConfiguration() + "' does not support transparency

What it means

Guard exception in the X11 setWindowTransparent path: it fires when the window's GraphicsConfiguration does not expose a translucency-capable 32-bit visual, so the window cannot be made transparent on this display. The fault is the window/display configuration, not the 'transparent' flag argument.

Solutions

  1. Check isWindowAlphaSupported() and GraphicsConfiguration.isTranslucencyCapable() before calling setWindowTransparent
  2. Create the window on a translucency-capable GraphicsConfiguration (select a 32-bit visual at frame creation)
  3. Skip transparency on displays lacking a compositing manager / 32-bit visuals
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at contrib/platform/src/com/sun/jna/platform/WindowUtils.java:1953 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of java-native-access/jna@d036ad9781 (2026-09-12). Data as JSON: /api/errors/33ff02b87574d49b. Report an issue: GitHub.

Appendix: source

Thrown at contrib/platform/src/com/sun/jna/platform/WindowUtils.java:1953

                x11.XFree(image.getPointer());
                x11.XFreeGC(dpy, gc);
                x11.XCloseDisplay(dpy);
            }
        }

        @Override
        public void setWindowTransparent(final Window w,
                                         final boolean transparent) {
            if (!(w instanceof RootPaneContainer)) {
                throw new IllegalArgumentException("Window must be a RootPaneContainer");
            }
            if (!isWindowAlphaSupported()) {
                throw new UnsupportedOperationException("This X11 display does not provide a 32-bit visual");
            }
            if (!w.getGraphicsConfiguration()
                .equals(getAlphaCompatibleGraphicsConfiguration())) {
                throw new IllegalArgumentException("Window GraphicsConfiguration '" + w.getGraphicsConfiguration() + "' does not support transparency");
            }
            boolean isTransparent = w.getBackground() != null
                && w.getBackground().getAlpha() == 0;
            if (transparent == isTransparent)
                return;
            whenDisplayable(w, new Runnable() {
                @Override
                public void run() {
                    JRootPane root = ((RootPaneContainer)w).getRootPane();
                    JLayeredPane lp = root.getLayeredPane();
                    Container content = root.getContentPane();
                    if (content instanceof X11TransparentContentPane) {
                        ((X11TransparentContentPane)content).setTransparent(transparent);
                    }
                    else if (transparent) {
                        X11TransparentContentPane x11content =
                            new X11TransparentContentPane(content);
                        root.setContentPane(x11content);

View on GitHub (pinned to d036ad9781)