I’m trying to display tooltips in Java which may or may not be paragraph-length. How can I word-wrap long tooltips?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you wrap the tooltip in
<html>and</html>tags, you can break lines with<br>tags. See https://web.archive.org/web/20060625031340/http://www.jguru.com/faq/view.jsp?EID=10653 for examples and discussion. Main take-awy from that discussion:fButton.setToolTipText("<html><font face=\"sansserif\" color=\"green\">first line<br>second line</font></html>");Or you can use the JMultiLineToolTip class that can be found many places on the net, including
https://github.com/ls-cwi/yoshiko-app/blob/master/src/main/java/com/yoshiko/internal/view/JMultiLineToolTip.java