Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2006

Tip: Looking for answers? Try searching our database.

sendkey method in java

Thread view: 
tremnac - 15 Dec 2006 11:05 GMT
hi,
we are trying to write a java program, in which will enter a key to
keyboard when it gets a specific string from user. In short, we are
trying to find a way in java which will be equvalent to SendKey Method
in Visual Basic. Does anybody can help in this process?

thanks for your help..
Manish Pandit - 15 Dec 2006 19:13 GMT
> hi,
> we are trying to write a java program, in which will enter a key to
[quoted text clipped - 3 lines]
>
> thanks for your help..

If you are using a text-mode program, the answer is no - because
keyboard is wrapped as System.in, which is an inputstream. You can
"read" from an input stream, but cannot write to it.

If you are using a Swing/AWT based program, you can create your own
KeyEvent and then post it - the listeners will receive the event as if
it came from the keyboard. You can get the system even queue by using
getToolkit().getSystemEventQueue() and then use the postEvent() method
passing in the programatically created KeyEvent.

Its not as easy as in VB though :)

-cheers,
Manish


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.