Results 1 to 9 of 9
  1. #1
    diva_garg is offline Member
    Join Date
    Aug 2008
    Posts
    8
    Rep Power
    0

    Default To get multiline tooltip

    HI,

    I am using ToolTip class of jface and I want to display tooltip text in multiple lines. Instead of appearing in a long line, the tooltip text should be shifted
    to a next line after a certain defined range. How can I set maximum width to tooltip?

    Please give your suggestions.

    Thanks & Regards,
    Divya

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    I don't know about jface but in java toolTip text has
    limited support for html 3.2
    So you could try something like
    Java Code:
    String s = "<html>hello world<br>" +
               "this is multi-line text";
    myJComponent.setToolTipText(s);

  3. #3
    diva_garg is offline Member
    Join Date
    Aug 2008
    Posts
    8
    Rep Power
    0

    Default Window's tooltip behaviour

    Hie,

    Thanx a lot for ur reply. It works fine.
    Can u plz help me in implementing tooltip's behavior in my application according to window's tooltip?

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  5. #5
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    In JFace you can make such stuff for making multiple lines:

    Java Code:
    String string = "This is a string\nwith a new line.";
    JLabel l=new JLabel("Label with tooltip");
    l.setToolTipText(string);

  6. #6
    diva_garg is offline Member
    Join Date
    Aug 2008
    Posts
    8
    Rep Power
    0

    Default

    I mean the behavior of windows operating system.
    how windows show tooltip when text is large or show tooltip in new line?

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    I don't think there is such inbuilt mechanism to do this. New-line character is the solution. Work on with the text length and define a new-line character in appropriate place.


  8. #8
    rclanahan is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default Line break in tooltip - GWT

    I found this page after much searching for a way to do a line break in a tooltip in GWT {setTitle("This is line1 \nThis is line2")}. I could find no reference to this for GWT anywhere and had tried many different things that I found... nothing worked. BUT the "\n" does work. I wanted to post this in case someone else has spent time, like me, looking for how to line-break a tooltip for GWT specficially. Thanks so much for the previous replies... they lead me to my answer.

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    This thread has nothing to do with GWT and all to do with Swing. I recommend that you start your own new thread about this rather than hijack an old and unrelated thread. Locking.

Similar Threads

  1. How to write multiline String in a JLabel
    By JavaBean in forum AWT / Swing
    Replies: 4
    Last Post: 12-14-2009, 05:09 AM
  2. tooltip
    By suman in forum New To Java
    Replies: 2
    Last Post: 07-31-2008, 01:57 PM
  3. Tooltip not getting displayed...
    By Preethi in forum New To Java
    Replies: 4
    Last Post: 07-31-2008, 10:00 AM
  4. How to dispose tooltip.
    By Preethi in forum New To Java
    Replies: 1
    Last Post: 07-22-2008, 07:06 AM
  5. Tooltip
    By Preethi in forum New To Java
    Replies: 5
    Last Post: 06-11-2008, 11:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •