I currently have 2 JFrames for my "game" (Not really a good one), one for the actual game and one for a minimap.

What I can't figure out is that when you click off the game (for example to a browser or something) the game and minimap loose focus, but when you click on the game again, the minimap may not show or is still not on top.

What I want is so that once the game is brought into focus (they are playing the game) the minimap is shown next to it, on top.

I hope that makes sense.

Any help is appreciated.

-- Turt2Live

5 Years
Discussion Span
Last Post by turt2live

standard is that you using just one JFrame and other TopLayoutContainers would be JDialog(s)

1/ it hard to manage Focus between two JFrames, nor to move one of then toFront() - sure its possible but code needed for that will be longer than your "game"

2/ JDialog#Modality - but chaning with JFrame Focus

3/ anyway is possible (search for that) set JFrame as parent for JDialog


Thank you very much :) I was trying to use a combination of WindowListners, Robots, and KeyEvents to hide the minimap, show it, then show the game.

Although I did learn that setting a JFrame to visible while it is already visible gives it focus :D

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.