1,105,384 Community Members

Robot class on a mac computer

Member Avatar
caswimmer2011
Light Poster
33 posts since Oct 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
Majestics
Practically a Master Poster
694 posts since Jul 2007
Reputation Points: 84 [?]
Q&As Helped to Solve: 66 [?]
Skill Endorsements: 6 [?]
 
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

Member Avatar
caswimmer2011
Light Poster
33 posts since Oct 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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?

Member Avatar
Majestics
Practically a Master Poster
694 posts since Jul 2007
Reputation Points: 84 [?]
Q&As Helped to Solve: 66 [?]
Skill Endorsements: 6 [?]
 
0
 
Member Avatar
harinath_2007
Posting Pro
509 posts since Aug 2010
Reputation Points: 56 [?]
Q&As Helped to Solve: 51 [?]
Skill Endorsements: 4 [?]
 
1
 

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

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: