We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,285 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Robot class on a mac computer

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

4
Contributors
4
Replies
2 Days
Discussion Span
1 Year Ago
Last Updated
5
Views
caswimmer2011
Light Poster
32 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Robot class to create robotic function of mouse, keyboard and screen... For executing a command or function you can use Runtime class.

http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Runtime.html

Majestics
Practically a Master Poster
696 posts since Jul 2007
Reputation Points: 209
Solved Threads: 66
Skill Endorsements: 5

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
Light Poster
32 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Majestics
Practically a Master Poster
696 posts since Jul 2007
Reputation Points: 209
Solved Threads: 66
Skill Endorsements: 5

@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.

harinath_2007
Posting Pro
509 posts since Aug 2010
Reputation Points: 108
Solved Threads: 46
Skill Endorsements: 3

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0676 seconds using 2.64MB