0

Is it possible in java to get text from a tooltip in a gui that I didnt make. For example, I may be in a web browser or on a desktop application with my java program running in the background. I want to get any tooltip info that pops up (at anytime) and return it to the java program.

Just to clarify i'm not asking about how to create tooltips or get tooltip data in gui I make only tooltips that appear in other 3rd party software. Thanks.

1 Answer 1

1

The Tooltip Text has to be "somewhere" in the software. "Somewhere" can be a handful of different places, depending on how the software is built and distributed:

  • String literals in the sourcecode (and thus in the bytecode, too), this often happens to non-internationalized programs
  • resource bundles, i.e. the Strings are externalized from the source code into a separate file (usually one per supported UI-language)

If the software is distributed as *.jar-File, use your favorite unzip-software to decompress is (when in doubt, use 7zip).

Look around for *.properties-files, these may contain the resource bundles (= collection of UI-text-Strings) you are looking for.

If you can't find resource bundles, the Tooltip Text is probably hidden in String literals directly in the bytecode. Use something like strings(1) on *nix-ish platforms (no link for this one, seems I can only post 2 links) or Strings on Windows to extract the printable Strings from the *.class-files.

Note that you might find lots of printable Strings in there, so you might want to filter them using a suitable regular expression.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.