java - requestFocus() not working with show() method -
i'm making game program has show 1 panel, , panel show previous panel, , show first panel again. make things simpler, let's have panela , panelb in cardlayout c
of panelc. program starts c.show(panelc, "panelb"); panelb.requestfocus();
. then, in panelb, happens: c.show(panelc, "panela")
. then, in panela, same thing happens again: c.show(panelc, "panelb"); panelb.requestfocus();
the first time around, requestfocus() works keylistener , game works fine. second time around when panelb shown, seems requestfocus not work , keylistener not respond events.
Comments
Post a Comment