-1

I'm new here and not so much familiar with applets. I searched the site and many other forums for answer but i found nothing. I have made an application in Java which starts with an applet login form, and continues with JFrame subforms which are doing several things like running JOptionPanes for example when a customer make a change in his profile. My problem is that when the JOptionPane appears, the applet start form comes on top even if i have opened 2 or 3 JFrames. I forgot to say that my app is big so i cannot post any code (and i think is not needed). Thanks in advance!

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Christina Mayer
  • 1
  • 1
  • 1
  • 1
  • 1
    See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556) But more importantly, do not launch so much as a single frame from an embedded applet. Make them all modal dialogs, or better still, free the entire GUI from the web page and launch it using JWS - free floating. – Andrew Thompson Dec 30 '12 at 02:30
  • 1
    While your application might be large, taking the time to put together a short, compileable example that demonstrates the problem will take the guess work out of our answers – MadProgrammer Dec 30 '12 at 02:36

1 Answers1

3

Avoid mixing frames and applets, your working with competing paradigms. If you MUST use an applet, use something like a CardLayout or JTabbedPane to allow the user to switch between forms.

If you can, try using Java Web Start, which will allow you to start your application off the web, but have the same restrictions as that of any embedded GUI.

As to your problem, it sends like you are mixing the native peer for the JOptionPane. Make sure that the parent reference is correct (ie references the frame or child of the frame)

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
  • *"have the same restrictions as applets do."* I would amend that to *'have the same restrictions as that of an embedded GUI.'* -- Note that applet themselves can be launched free floating using JWS (since around 1.2), and a sand-boxed applet or JWS app. have almost identical *security managers* (unrelated to what you were referring to, but not ruled out by the words). – Andrew Thompson Dec 30 '12 at 03:03