This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

function key F13 - F24

Ranch Hand
Posts: 184
MS IE Notepad Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I couldn't come up with a better thread title - if anyone has a suggestion feel free to report to mods for modify.

As I'm a player of Minecraft I came up with this: Why not use F13 - F24?
Reason: Although "vanilla" Minecraft is fine with around 20 key bindings, when you play it with modifications you encounter the problem of quickly run out of possible key bindings. Another issue: differnt keyboad layout - but that's beyond this topic.
To test if Minecraft is even capable of using F13 - F24, wich is supported by Java natively, I came up with a rather complicated test: I quickly set up a "server" wich received keycodes from another PC in my LAN (wich ran a "client" sending some) - yes, it works (although a bit delayed cause of TCP - guess this could be fixed with UDP).
As my keyboard is not able to produce inputs for F13 - F24 (it's an Logitech K800) I thought I could use a small extra code to send such keycodes. The issue I encountered: Robot in awt package only sends keycodes to current active window. So if I set up a small GUI with buttons for the "2nd row Fn-keys" it would send the key presses to this instead of Minecraft as its window has the current focus. I already came up with the idea of using a FocusListener and queue up the keys until the window lose focus (wich happens when I click back in the Minecraft window). But this doesn't work as when Minecraft window loses focus it pops up a menu wich as to be closed before the key presses would do what they should. Sadly, when sending a press/release VK_ESCAPE to close the menu isn't reliable as there could be additional delay after closing the menu (or closing the text prompt when opened before window lose focus).

Has anyone other ideas how this may could be accomplished?

Thanks in advance,

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!