Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are not afraid of extending swing tool tip, you can create your own JMultiLineToolTip:</p> <ol> <li>Extend JTooltip In the extended Tool tip component implementation,</li> <li>set a custom tool tip UI In customUI implementation</li> <li>Implement<code>paint()</code> method to write given string in multi line</li> </ol> <p><a href="http://www.java2s.com/Code/Java/Swing-JFC/MultiLineToolTipExample.htm" rel="noreferrer">Here is an example</a> - it shows how to use it as well</p> <p>However, to answer your questions:</p> <ol> <li><p>Which JMultiLineToolTip is a good one to use?</p> <p>Use <code>&lt;html&gt;</code></p></li> <li><p>How can I use such a class to represent all of the tooltips in my application?</p> <p>Per compopnent, it is easy but tedious to achieve as you will have to override <a href="http://docs.oracle.com/javase/1.5.0/docs/api/javax/swing/JComponent.html#createToolTip%28%29" rel="noreferrer">creatreToolTip()</a> API. But if you want to change it globally, you may:</p> <p>(i)Simple way - Register your custom tooltip UI with the <code>UIManager</code> at the beginning of your execution.</p> <p><code>UIManager.put( "ToolTipUI", "SeNormToolTipUI" );</code></p> <p><code>UIManager.put( "SeNormToolTipUI",Class.forName( multiLineToolTipUIClassName ) );</code></p> <p>(ii) complex way</p> <p>You will have to start implementing your own look and feel. In the look and feel implementation, you would provide defaults for <code>ToolTipUI</code> as your UI implementation and then set that look and feel to the application you are running. For instance take a look at the <a href="http://www.koders.com/java/fid555169BAAFFA92F84223B548C83D4655041815E3.aspx?s=204#L884" rel="noreferrer">MetalLookAndFeel implementation</a>. You may just extend that part and implement your on lnf.</p></li> </ol> <p>So, it is better to use <code>&lt;html&gt;</code></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. 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