I struggled with this quite a bit when I first started with J-Link & Java. It turns out it's a bug with J-Link: the first JoptionPane window you call in a Pro/E session will (nearly) always open behind the Pro/E window. Subsequent windows will appear in front.
It's a shame it works this way, because JoptionPane is so easy and compact to use. To get around it, you have to use Jdialog commands, which forces you to get into all of the annoying details of GUI creation even for simple tasks.
I am no Java expert, but I think the course most people choose it to just set up a method to create and show a basic GUI, and then add it as needed to your code.
Best Regards,