1

The jist of the problem is this: I have two JFrames, lets say a big JFrame Foo and smaller JFrame Baz. I have both open at the same time, is there a way to make Baz never be hidden "behind" Foo? Right now when Baz is "in front" and I click on Foo, Baz disappears behind Foo, which I don't want to happen.

Others
  • 2,876
  • 2
  • 30
  • 52

2 Answers2

5

Don't use two JFrames. You are trying to make the "bar" window behave like a dialog, and thus it in fact should be a dialog, a JDialog to be exact, and it should be set up so that its parent window is your "foo" JFrame.

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
2

You could look at Java - control Z order of JPanels.

If using a JDialog is not an option (because you need a JFrame) then you could use this to manually define z-order rules.

Community
  • 1
  • 1
sjr
  • 9,769
  • 1
  • 25
  • 36