Results 1 to 3 of 3
  1. #1
    pseeburger is offline Member
    Join Date
    Jan 2012
    Posts
    14
    Rep Power
    0

    Default JDialogs opened by JApplet being hidden behind browser in Firefox when focus lost

    I've written a fairly extensive JApplet called CalcPlot3D that frequently opens non-modal JDialogs to handle the creation of various objects to be graphed. The normal behavior of JDialogs in Java, as I understand it, is to always stay in front of the parent frame that opened it.

    However, in recent versions of Firefox on both the Mac and in Windows Vista and Windows 7, (and most recently in Safari on the Mac), these JDialogs disappear behind the browser window when I click on the main applet (housed in a webpage in the browser). If I open a second JDialog, the other JDialogs will also appear, but all are again hidden when the webpage/browser/main applet get the focus again.

    I have come up with two solutions to this, neither of which I am completely satisfied with.

    1. When the applet is housed in the browser window, I force all JDialogs to be alwaysOnTop, by setting this property to true. This can be fairly annoying if the user switches to another application, since these JDialogs are still on top and visible wherever the user goes until he/she closes them. But this seems to at least keep the JDialogs around to be useful while using the applet.

    2. The other somewhat cleaner solution I have found is to display the applet in a separate JFrame above the browser. See my post on another thread in the Java Applet area of the forum to see how I did this. This takes care of this JDialog focus/disappearing issue, and it also takes care of a few other recent issues that have come up in Firefox on the Mac (the biggest of which I posted a question about last night, that is, the JMenuBar does not function correctly).

    Has anyone else observed this behavior with JDialogs in their own JApplets? Does anyone know why this behavior has started on Firefox (and Safari), yet does not show up on IE or in the AppletViewer? Is it really a bug in Firefox? Or is there possibly something I may be doing that is causing my trouble?

    Thanks!

    Paul

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: JDialogs opened by JApplet being hidden behind browser in Firefox when focus lost

    What are you using for the owner of the JDialog when you create it?

  3. #3
    pseeburger is offline Member
    Join Date
    Jan 2012
    Posts
    14
    Rep Power
    0

    Default Re: JDialogs opened by JApplet being hidden behind browser in Firefox when focus lost

    Quote Originally Posted by Fubarable View Post
    What are you using for the owner of the JDialog when you create it?
    I am using the following call to get the parent frame for the applet.

    Java Code:
    Frame frame = JOptionPane.getFrameForComponent(this);
    Here of course
    Java Code:
    this
    refers to the main JApplet that typically resides in a webpage in the browser.

Similar Threads

  1. JApplet connecting to the database in browser
    By pinxrick in forum Java Applets
    Replies: 3
    Last Post: 03-22-2011, 05:12 AM
  2. Replies: 8
    Last Post: 03-10-2011, 08:00 PM
  3. japplet - jtable - browser
    By jasonnuigi in forum Java Applets
    Replies: 1
    Last Post: 12-31-2010, 03:16 PM
  4. Replies: 6
    Last Post: 06-07-2010, 04:47 PM
  5. Replies: 3
    Last Post: 09-23-2009, 09:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •