Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've tested this with a standard label and it works:</p> <pre><code>Label ml; String msg = "Hello! \n I'm here."; add(ml = new Label("multiline",msg)); ml.add(AttributeModifier.append("title", msg)); </code></pre> <p><strong>UPDATED</strong></p> <p>Unfortunately it's not possible to control the style of the tooltip generated with the attribute 'title' because it's a OS native component. However you could easily adapt the code you have found at <a href="http://www.mkyong.com/jquery/how-to-create-a-tooltips-with-jquery/" rel="nofollow">http://www.mkyong.com/jquery/how-to-create-a-tooltips-with-jquery/</a>. You can put the text of the tooltip in a custom attribute, let's call it 'toolTipText':</p> <pre><code>String tooltipMsg = Strings.toMultilineMarkup(yourMsgFromDb).toString(); ... yourLabel.add(AttributeModifier.append("toolTipText", tooltipMsg)); </code></pre> <p>Please note that you must use toMultilineMarkup to maintain the line breaks in the tooltip. Now you should slightly modify function showTooltip to use the value inserted into the custom attribute:</p> <pre><code>var showTooltip = function(event) { $('div.tooltip').remove(); $('&lt;div class="tooltip"&gt;' + $(this).attr('toolTipText') +'&lt;/div&gt;') .appendTo('body'); changeTooltipPosition(event); }; </code></pre> <p>Finally, you have to tell JQuery to use tooltip with your tag. You must replace "span#hint,label#username'" with the selector matching your component.</p> <p>I've tested and it seems to work.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload