Hello,

I got a MacBook Pro for college and i'm trying to program on it. It's all good except when i use the robot class, i don't see any key codes or key events for keys such as function, option, and command. Can i use those keys when using the robot class?

Thanks in advance!

-Nick

Recommended Answers

All 4 Replies

Maybe I did not phrase the question right. I am wondering how to use the robot class with a mac computer because I need to use keys such as function, command, and option. Is there a way to have the computer type those keys for me?

@caswimmer2011 What you want to say ?.

From your posts i understand that you want to use robot class for pressing the function keys (like f1,f2 etc) programatically.
For that you need not worry about your OS or computer type(laptop etc).

IF you want to press function keys for example f1
Here's how you do this..

Robot r=new Robot();
r.keyPress(KeyEvent.VK_F1);

For other keys refer KeyEvent class.

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.