views:

36

answers:

1

I have a JFrame with an associated JPanel which fill the screen, both having setFocusable(false) and in Front another JFrame with a Jpanel with a fixed size and centered (both are unmoveable). In this 'front' Panel theres a game, but when i click on the background Frame the front Panel moves to the background i only see the (dark grey) background Panel.

This is very annoying as you can imagine and i guess there must be a simple solution (i thought the setFocusable(false) would do the trick) but i simply cannot find it

+1  A: 

Have you tried JFrame.setAlwaysOnTop( true )

OscarRyz
nope - and works fine, thank you! Is there something similar to keep focus? Like keylisteners dont react when i click away
Samuel
Yes, use the GlassPane http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html#glasspane
Cesar
@Samuel , in stackoverflow nothing says "Thank you" as an upvote and an accepted answer mark :) :) You're welcome.
OscarRyz
Fine happy xD? i was going to give you, just waiting for a reply :) (Therefor Cesar's upvote too ^^)
Samuel
pooooooints... ppppappOOOOooooOOOooointss... happy = true :P I warn you, these things are addictive, run while you can!!! ruuuun, rrrUUUUUUUUUUUUUUnnnN!
OscarRyz