Q:

Insert text to a web browser and a Java application at the same time

I developing a Sinhala-English Unicode converter in  java.Now I want to add the final output unicode sinhala word in facebook chat window while i typing them.If i type a word in application that letters also should  print on facebook chat(Web browser's active window) window in any browser.I think the problem might be slightly unclear.But I expect any kind of answer for this problem...

A:

Java has only one tool that allows emulation of user activity: java.awt.Robot. Using this class you can emulate mouse clicks and keyboard usage, so theoretically you can select browser window, then select text area on site and "type" any text you want. The problem with this solution is that current java API does not allow you to identify native window, so it is not easy to find the browser among the windows existing on user's desktop. 
Finally, exactly as @Jonas said - better use Facebook API. 

