Question: Can some one help me with this code. To give a run down I am trying to use the robot class to type a city

Can some one help me with this code. To give a run down I am trying to use the robot class to type a city name, so I have a scanner input to recieve the city name and then convert the string into a char array and then in the Keypress robot object I have a loop that types each chacter until down. the problem is I dont know how to represent the char values when invoking the key press method. here is the code bit Im talking about

Can some one help me with this code. To give a run

I tryed putting a1 or i in the parenthesis of the method neither seems to work. Help would be much appreciated

Scanner sc = new Scanner(System.in); System.out.print("Enter City"); string city = sc.next(); char [] a1 city.toCharArray(); for(int 1-0 ; 1 al.length; i++) { System.out.print(i); Keypress (a1); try robot = new Robot(); catch (ANTException e) e.printStackTrace); public static void Keypress (char i) f for( 1-0; i 20 ; i++) { robot.keyPress (KeyEvent.VK_SHIFT); robot.keyPress (i); robot.keyRelease(i); robot.keyRelease (KeyEvent.VK_SHIFT)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!