0

I just wanted a code where I can display partial text and the remaining text by the tool tip using 'JTextPane'.

Eg: If text is 'Java is re useable'. I want it to display 'Java is ...' Then I want to add a tooltip to display the rest of the data.

Please do let me know how it is done.

Thanks.

mKorbel
  • 109,525
  • 20
  • 134
  • 319
  • I think this question is already asked. See if it answers your question. http://stackoverflow.com/questions/1915869/how-can-i-create-an-autocomplete-popup-in-a-jtextpane-in-java – Vivek Oct 22 '12 at 12:32
  • 2
    Welcome to stackoverflow. Please tell us what you have tried to achieve your goal. – siebz0r Oct 22 '12 at 12:32
  • Or maybe have a look at this page: http://stackoverflow.com/questions/6561506/adding-tooltips-to-jtextpane – mcalex Oct 22 '12 at 12:35
  • Please post an [SSCCE](http://sscce.org) which demonstrates what you are trying to achieve and the problems you have encountered. – David Kroukamp Oct 22 '12 at 13:59

1 Answers1

2

This is the default behavior of a JLabel whose current width is less that its preferred size. You can study the effect by resizing the enclosing frame in this example, which overrides layoutCL() to display the text layout state.

image

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045