robot

I have a java application in which i want to simulate ctrl c, ctrl v and ctrl x

here is a part of the code i used inside a mouse listener

elseif(event.getActionCommand().equals("Cut"))

{

System.out.println("cut call");

robot.keyPress(KeyEvent.VK_CUT);

robot.keyRelease(KeyEvent.VK_CUT);

}

and this doesn t work

if i do a KeyEvent.VK_C instead per example it works c will appear in the textfield am targetting but copy wont work

i also try

elseif(event.getActionCommand().equals("Cut"))

{

robot.keyPress(control);

robot.keyPress(KeyEvent.VK_X);

robot.keyRelease(KeyEvent.VK_X);

robot.keyRelease(control);

System.out.println("cut call");

}

no result

I am using a mac os but i test my code on window and as on mac no result.

The reason why i am using robot is because i want people to be able to copy from my application and to copy outside of my application

Thanks in advance

[1354 byte] By [lildavesflavaa] at [2007-11-27 5:18:19]
# 1

Ps

here is a code which i should have included

if(System.getProperty("os.name").startsWith("Mac OS"))

{

control = 157;

}

else

{

control = KeyEvent.VK_CONTROL;

}

157 is what i get when i press the apple key on my keybord

lildavesflavaa at 2007-7-12 10:41:27 > top of Java-index,Desktop,Core GUI APIs...