开发者

java Window class does not dispatch key events?

开发者 https://www.devze.com 2023-04-01 13:09 出处:网络
I have extended the class Window to create the MetroWindow class, which is like the normal Window except that it is looks nicer.

I have extended the class Window to create the MetroWindow class, which is like the normal Window except that it is looks nicer.

When I add a TextField to it, I hear beep beep when I hit my keyboard and no letters are shown in the TextField. If, instead of extending Window, I extend JFrame, the TextField are able to receive keystrokes correctly.

I want to keep extending Window for my UI, 开发者_JS百科but I would like to receive the correct keystrokes on my TextField. How do I do this - dispatch keystroke, create listeners... ?


Sorry for providing an answer to my own question, but In case someone is looking for a solution...

What I did was to extend JFrame instead of Window.

I then set JFrame.setUndecorated(true);

this hides the toolbar which is what I was looking for.

0

精彩评论

暂无评论...
验证码 换一张
取 消