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.

有帮助吗?

解决方案

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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top