Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mac Java runtime, JDialog getting stuck behind parent JDialog

Jim Chandler
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

This seems to be platform-specific, but before I try to dig through the Mac forums, I thought I'd try here.

The application we are developing runs as one JFrame, which is the main navigation window (done with a JTree,) and all opened windows exist hierarchically underneath that initial JFrame as JDialogs(JFrame).

Many of these "main windows," again JDialogs under that parent JFrame, have their own subsidiary JDialogs {new JDialog(JDialog)}that can run as satellite windows, such as tear-off dialogs and such. These are all constructed hierarchically by passing the owning dialog to the constructor.

Here's some sample code that demonstrates the problem. I can see it on both Tiger and Leopard Mac OS's. When this sample is run, it will pop up five little windows. If you click from one second-level dialog to the other, the lowest level dialogs get stuck behind their parent dialogs, and can't be brought back to the front unless you close/reopen, or minimize/maximize the main JFrame. This can easily be recreated by sliding the subdialogs so that they partially cover their parent dialogs, then clicking the parent dialogs back and forth. Again, this only happens on the Mac - on Windows, this sample code works perfectly with no issues.

You can click from teapot to stout and back, and it quickly puts the subdialogs behind, and there's no way to get them back to the front until you minimize and maximize the main JFrame object - which then restores the hierarchy properly.

If you do the same on Windows, the subdialogs always stay in front of their parent dialogs, as they should.

In any case, this either seems to be a huge glaring bug, or something obvious that I'm missing. Since it exists in both Mac OS's, I tend to lean toward my missing something obvious ~~~ anyone have any ideas?

Thanks in advance for any replies,


import javax.swing.*;

public class TestFrame extends JFrame

public TestFrame()

JDialog topDog1 = new JDialog(this);
JDialog topDog2 = new JDialog(this);
JDialog littleDog1 = new JDialog(topDog1);
JDialog littleDog2 = new JDialog(topDog2);
JLabel l1 = new JLabel("I'm a little teapot");
JLabel l2 = new JLabel("Short and stout");
JLabel l3 = new JLabel("Here is my handle");
JLabel l4 = new JLabel("Here is my spout.");

public static void main(String[] args)
new TestFrame().setVisible(true);

[ April 16, 2008: Message edited by: Jim Chandler ]

[ April 16, 2008: Message edited by: Jim Chandler ]
[ April 16, 2008: Message edited by: Jim Chandler ]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic