Swing indeed. And before that AWT (which is still at the back of Swing in the non-visual area).
There's nothing like that for C++. Each compiler and platform has its own user interface libraries, and often a plethora of them, some of which work only on some platforms and libraries and others on others.
Yeah, if you make a C++ application and insist on using one of the operating system's GUI systems/APIs directly, you're gonna run headfirst into portability issues. If you use a multiplatform layer inbetween, something like Qt or GTK or similar: your app will work the same on windows, mac, and linux.. the portability issue disapears ( as long as those are your target platforms.. ). Same with 3D even; use SDL + OpenGL, and all necessary porting is taken care of, between windows and linux atleast. I see the 'C++ apps aren't portable' argument as a myth; from experience with 2 largish apps: as long as I'm careful and avoid ( or allow the switching of [ which is rarely necessary ] ) all platform-specific code, and use multiplatform libs where appropriate; building the same code on windows and linux is trivial.