The relevant Apple dev doc is here: https://developer.apple.com/library/mac/technotes/tn2229/_index.html
Essentially it involves setting flags on the GL pixel format. Then you can receive a callback from the OS either via NSOpenGLView or an old C style callback which tells you that the active GPU has changed. I haven't read the JFX Mac GL code so I don't know what APIs it's using. In the callback you are meant to re-query GL capabilities and redraw, I think. There's also some extra work required if you use pbuffers or GL textures instead of framebuffer objects. I don't know which JFX uses.