• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to show a long description in a jtable ?

 
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a requirement where my user enter a long description about a product or tender , but when i display that in a jtable then only half part is displayed and rest is shown in this way ....
with dots
can you suggest me a alternative where i can show this description in full details the way my user have entered it ?
 
Ranch Hand
Posts: 160
IntelliJ IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not show the full description in a tooltip popup when the user hovers over the description column?
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Custom renderer/editor that uses a JTextArea.
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Naved,
I suggest attaching a JPopupMenu to the table cell containing the description.
The popup menu would have a "Show All" item.
Choosing that item would display a dialog window with a scrollable JTextArea displaying the entire description.

Also note that if you try the tooltip option that Riaan suggested, I suggest you use HTML to format the tooltip text because you may end up with a tooltip that stretches wider than the screen which would result in still not being able to view the entire description.
(Speaking from experience :-)

Good Luck,
Avi.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I like the tool tip suggestion.

Otherwise if you want to see the entire text you need to change the width of the column. However I would only use this approach when you have a reasonable maximum size, say 30-50 characters. If you are going to enter multiple sentences then you need another approach. the Table Column Adjuster can do the column resizing automatically.
reply
    Bookmark Topic Watch Topic
  • New Topic