I would do the following: Add a field "JFrame actualB" in the class of JFrame A, and initialize it to null. If the Button is pressed, check whether actualB is null; if so, create B and store it in actualB. If not, call "actualB.toFront()". Code looks somehow like:
If (actualB==null) actualB = new JFrameB(); else actualB.toFront();
Thanks Timo and Gary, it works fine right now Had to add window listeners to reset the JFrame actualB to null when it was closed, otherwise it wouldn't work afterward.