private void openSystemMenu( HWND hwnd, int x, int y ) {
			// get system menu
			HMENU systemMenu = User32Ex.INSTANCE.GetSystemMenu( hwnd, false );

			// update system menu
			int style = User32.INSTANCE.GetWindowLong( hwnd, GWL_STYLE );
			boolean isMaximized = User32Ex.INSTANCE.IsZoomed( hwnd );
			setMenuItemState( systemMenu, SC_RESTORE, isMaximized );
			setMenuItemState( systemMenu, SC_MOVE, !isMaximized );
			setMenuItemState( systemMenu, SC_SIZE, (style & WS_THICKFRAME) != 0 && !isMaximized );
			setMenuItemState( systemMenu, SC_MINIMIZE, (style & WS_MINIMIZEBOX) != 0 );
			setMenuItemState( systemMenu, SC_MAXIMIZE, (style & WS_MAXIMIZEBOX) != 0 && !isMaximized );
			setMenuItemState( systemMenu, SC_CLOSE, true );

			// make "Close" item the default to be consistent with the system menu shown
			// when pressing Alt+Space
			User32Ex.INSTANCE.SetMenuDefaultItem( systemMenu, SC_CLOSE, 0 );

			// show system menu
			int ret = User32Ex.INSTANCE.TrackPopupMenu( systemMenu, TPM_RETURNCMD,
				x, y, 0, hwnd, null ).intValue();
			if( ret != 0 )
				User32Ex.INSTANCE.PostMessage( hwnd, WM_SYSCOMMAND, new WPARAM( ret ), null );
		}
Opens the window's system menu.
The system menu is the menu that opens when the user presses Alt+Space or
right clicks on the title bar
flatlaf-natives/flatlaf-natives-jna/src/main/java/com/formdev/flatlaf/natives/jna/windows/FlatWindowsNativeWindowBorder.java