How would I listen for keypresses in a window?
I'm working on a game and want to grab keyboard input while a specific window is focused. It wont have many components, should just be a JTextArea(that can't be edited) though Ill probably add more as I get better with JFrames. How would I listen for the keyboard input? A key listener?
3 Replies
⌛
This post has been reserved for your question.
Hey @blockgoblin31! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
ok I just needed to add .setFocusable(true)
Post Closed
This post has been closed by <@501514065068294154>.