We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,106 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Dual JFrame Focus Thing

Hello,

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

2
Contributors
2
Replies
6 Hours
Discussion Span
2 Years Ago
Last Updated
3
Views
Question
Answered
turt2live
Junior Poster in Training
90 posts since Jan 2011
Reputation Points: 15
Solved Threads: 3
Skill Endorsements: 0

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

mKorbel
Nearly a Posting Virtuoso
1,214 posts since Feb 2011
Reputation Points: 482
Solved Threads: 239
Skill Endorsements: 12

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

turt2live
Junior Poster in Training
90 posts since Jan 2011
Reputation Points: 15
Solved Threads: 3
Skill Endorsements: 0
Question Answered as of 2 Years Ago by mKorbel

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0645 seconds using 2.72MB