• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JScrollPane inside a JTable cell

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am in an urgent need to implement a JTable where each cells will contain multiline text. When text content exceeds my cell size I want a JScrollbar to appear so that I can see the entire content inside my table cell.
I desperately need help on this, please help me out.
many thanks in advance.
Ramesh
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
extend JPanel or JScrollPane (or some custom component) and implement the TableCellRenderer (see the source of DefaultTableCellRenderer for performance issues!)
you have to set the row height of the JTable appropriately or it will be to small.
moreover, the mouse events have to be transmitted to the scrollpane:
you have to write a custom TableCellEditor for this:

see this page for a more general sample:
http://www.codeguru.com/java/articles/162.shtml
Chantal
reply
    Bookmark Topic Watch Topic
  • New Topic