Search code examples
javaswingtooltipjavahelp

Changing "Favorites" Tooltip in Java Help


In my helpset file, I'm declaring a favorites view, using

<view>
  <name>Lesezeichen</name>
  <label>Lesezeichen</label>
  <type>javax.help.FavoritesView</type>
  <data></data>
</view>

This automatically adds an appropriate button to the toolbar (in the swing application). Unfortunately, the tooltip of the button reads "Add to favorites". I would like to replace this by my own text, but didn't find anything about this in the documentation or using a google search. Any ideas or pointers?

Disclaimer: I already posted this question to JavaRanch, didn't get an answer yet, though.


Solution

  • If you extract the src.jar (rename it to src.zip and extract) and open the java class jh2.0/src/src/javax/help/resources/Constants.java you will notice that in the section

    // Tooltips for Actions
    

    is located entry for localization:

    { "tooltip.FavoritesAction", "Add to Favorites"},
    

    This constant is missing from the jh2.0/src/src/javax/help/resources/Constants_de.java which is used in your case. Just add the right translation, compile the source or just this class and add it to the jh.jar (you may treat the jar as a simple zip archive)

    Yes, I know this is dirty hack, but generally JavaHelp is quite useful