I am now programming in a MacBook Pro and for the KeyCodes in the Robot Class, there is no set key for Command. Can I set a KeyCode to do the actions of the Command key?


Recommended Answers

All 4 Replies

The list of VK_... key codes can be found in the JavaDoc for KeyEvent. eg the control key is VK_CONTROL.
I don't know about how the Mac Command key is coded, maybe its its the same as VK_WINDOWS? (easy to try!), but you could write a very small program with a KeyListener and print out the key code that is passed into your keyPressed method,

Good idea with the VK_WINDOWS key, but it did not work :( I was trying to avoid that, but I think it is the only way. Would you have any idea how to get started?

Write a small program, implementing keyListener. On the key pressed method, you print out te character.

I actually found one online and modified it. Turns out to be keycode 157. Thanks for helping!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.