aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JScrollPane inside a JTable cell Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JScrollPane inside a JTable cell " Watch "JScrollPane inside a JTable cell " New topic
Author

JScrollPane inside a JTable cell

Rames Raja
Greenhorn

Joined: Jan 27, 2003
Posts: 7
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
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JScrollPane inside a JTable cell
 
Similar Threads
JTable Editing
JTable
Table Model data not getting updated after JTable looses focus
jtable
JTable