There are a few last items to take care of in the Robot project. To end the switch statement, the code displays an error message if it can't understand an entered command. Also, the TRy statement that encloses all the Robot operations ends with a catch statement that reports any errors. And at the very end of the code, the setVisible method of JFrame brings the Robot back into view: default: System.out.println( "I didn't understand that command."); } catch (Exception ex){System.out.println("Error: " + ex.getMessage());} setVisible(true); } That completes the codeyou're ready to start running other programs via remote control, sending keystrokes and mouse events, taking screen shots, and more. There's a lot of power here. NOTE Download the complete source code for the Robot project, RobotProject.java, at the Sams website. After compiling the needed file (to create RobotProject.class), you can run it and get started controlling other programs. |