How to press combination key using java Robot class ???


****************************************************************
COMPLETE SOURCE CODE FOR : PressCombinationKeyUsingRobot.java
****************************************************************


import java.awt.Robot;

import java.awt.event.KeyEvent;

public class PressCombinationKeyUsingRobot
{
public static void main(String[]args)
{
//Combination Alt+F4 is a window close order in windows operating system
//How to implement combination of Alt and F4 in using Robot class

try
{
Robot a=new Robot();
a.keyPress(KeyEvent.VK_ALT);
a.keyPress(KeyEvent.VK_F4);
a.keyRelease(KeyEvent.VK_ALT);
a.keyRelease(KeyEvent.VK_F4);
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}


****************************************************************
JUST COMPILE AND EXECUTE IT
****************************************************************

How to make a program that can press keyboard for you ???


*******************************************************
COMPLETE SOURCE CODE FOR : PressKeyboard.java
*******************************************************


import java.awt.Robot;
import java.awt.event.KeyEvent;

public class PressKeyboard
{
public static void main(String[]args)
{
try
{

Robot a=new Robot();

while(true)
{
//THIS PROGRAM WILL PRESS A FOR YOU
a.keyPress(KeyEvent.VK_A);

//THIS PROGRAM WILL SLEEP FOR 5 second
a.delay(5000);
}
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}


*******************************************************
JUST COMPILE AND EXECUTE IT
*******************************************************

How to move cursor on screen using java ???


******************************************************************
COMPLETE SOURCE CODE FOR : MovingCursorOnScreen.java
******************************************************************


import java.awt.Robot;

public class MovingCursorOnScreen
{
public static void main(String[]args)
{
try
{
int Xcoordinate=10;
int Ycoordinate=50;

Robot a=new Robot();

//this method will move your cursor to the location base on Xcoordinate and Ycoordinate
a.mouseMove(Xcoordinate,Ycoordinate);
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}


******************************************************************
JUST COMPILE AND EXECUTE IT
******************************************************************

Source code to convert integer to string in java


*****************************************************
COMPLETE SOURCE CODE FOR : ConvertIntegerToString.java
*****************************************************


public class ConvertIntegerToString
{
public static void main(String[]args)
{
int sampleNumber=123;

//Convert integer to string
String stringForNumber=Integer.toString(sampleNumber);

System.out.println(stringForNumber);
}
}


*****************************************************
JUST COMPILE AND EXECUTE IT
*****************************************************

RELAXING NATURE VIDEO