void () { // exec at glib-thread if (isRootsUpdated || !isEnabled || myIsDisposed) { return; } if (xid.get() == 0) { LOG.debug("can´t update roots of frame " + frame + " because xid == 0"); return; } isRootsUpdated = true; if (windowHandle == null) { windowHandle = ourLib.registerWindow(xid.get(), this); if (windowHandle == null) { LOG.error("AppMenu-service can't register xid " + xid); return; } } ourLib.clearRootMenu(windowHandle); List<MenuItemInternal> cRoots = roots; if (cRoots == null || cRoots.isEmpty()) { return; } for (MenuItemInternal mi : cRoots) { mi.nativePeer = ourLib.addRootMenu(windowHandle, mi.uid, mi.txt); _processChildren(mi); } if (!SHOW_SWING_MENU) { EventQueue.invokeLater(() -> { if (isEnabled) { JMenuBar menuBar = getMenuBar(frame); if (menuBar != null) { menuBar.setVisible(false); } } }); } }