• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mac Java runtime, JDialog getting stuck behind parent JDialog

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,

-Jim

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.");
topDog1.getContentPane().add(l1);
topDog2.getContentPane().add(l2);
littleDog1.getContentPane().add(l3);
littleDog2.getContentPane().add(l4);
topDog1.pack();
topDog1.show();
topDog2.pack();
topDog2.show();
littleDog1.pack();
littleDog1.show();
littleDog2.pack();
littleDog2.show();
}

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 ]
 
It's a tiny ad. At least, that's what she said.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic