How to focus a JFrame?

后端 未结 6 945
隐瞒了意图╮
隐瞒了意图╮ 2020-12-03 18:05

I am writing a small game, with one JFrame that holds the main game, and another JFrame that displays the score. the problem is, when I am done constructing them, the score

6条回答
  •  抹茶落季
    2020-12-03 18:37

    The way that I would do is:

     frame.toFront();
     frame.setState(Frame.NORMAL); 
    

    and If you also want have more control on it you should use requestFocuse.

    BTW, here is an example : http://coding.derkeiler.com/Archive/Java/comp.lang.java.gui/2006-06/msg00152.html

提交回复
热议问题