views:

75

answers:

1

If you know babylon translation tool you'd know its word capture feature - when you right click on a word - it tanslates it (from a browser or any documtent). I want to get the same tool - what program language should i use ? The os i want to get it work on is win-xp and ubuntu. and I'm writing my program in java. if it could happen from a java program it would be great. thanks,

Adi.

A: 

You are facing two (IMHO) insurmountable challenges:

  • Windows and Linux use completely different mechanisms for displaying text on screen. Translating mouse positions into actual text is pretty darned difficult. This is hard even if you're targeting a single operating system.

  • Java apps generally run in a sandbox, i.e., they can't just go mucking around in the OS asking other windows to tell them what text is under the mouse, nor can they override the default right-click action windows they don't control.

A better UI approach would be something that uses the system clipboard, which I think is available to Java on all systems (I'm not a Java guy, I'm not sure). So, the user would copy a word in any window, perhaps hit some sort of global shortcut key (again, assuming you can assign one in a Java app), and the Java app could access the word in the clipboard and do what it needs to do.

richardtallent