How to make a magic with Java ?

How to make a magic with Java ?

Its not ofcourse completely true that we can make a magic with java , but its better to say that the entire credit goes to Java ( The Robot class ).

What the Robot class does ?
   Robot class , the name itself says that it acts like a robot , it can type , move the mouse.
Here is the sample demonstration of the Robot class.






import java.awt.*; // Robot class is in awt package

import java.awt.event.*; // For KeyEvent class

class RobotDemo

{

         public static void main(String args[]) throws Exception
 
                         {

                         Robot rbt=new Robot();

                         rbt.delay(5000); // wait for 5 seconds to open a text-editor like notepad

                         rbt.keyPress(KeyEvent.VK_H);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_A);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_I);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_SPACE);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_I);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_SPACE);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_A);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_M);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_SPACE);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_A);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_SPACE);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_R);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_O);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_B);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_O);
rbt.delay(100);
                         rbt.keyPress(KeyEvent.VK_T);
                         }
}