• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Auto copy/pasting to other apps in Java

Senor_Pointy

Fruity
Joined
Jun 24, 2006
Messages
670
Location
Sideways
I've been using Java for a lot of my programming needs for the past 6 months or so (because it's so much easier to make windows/UIs with than C++), but I've come across a problem I can't seem to figure out.

Is it possible to, in Java, copy a string of text to the system clipboard, then automatically paste it into another window? The other window is one of an entirely different application.

Oh, and if it matters, I'm running windows.


Thanks,
 
You can copy to the system clipboard in Java, in a system-independent way (i.e. it doesn't matter that you're running Windows). Here's a good rundown of how to do it.

The hard part is getting the other application to automatically paste it in. There's very likely no practical way to get control of the other application from within your Java program, and that step would have to be done by hand.
 
That has done it for the copying to part, Thanks!

I suspect you're right about the pasteing, but no sense in not asking!
 

Back
Top Bottom