• Post Reply Bookmark Topic Watch Topic
  • New Topic

text across JTable columns

 
s abs
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a JTable and I need the text in the columns to wrap across columns,like the default behaviour of Excel.
I am using the jtable to display an image and a text alongside.The text along the image should wrap across the columns
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
by specifying you own table cell renderer, for example based on a JPanel, you can display each cell as a JPanel and thus add images and multi-line text to it. See the src of DefaultTableCellRenderer (1.4).
You will have to set the row height yourself to assure that the whole panel is visible.
Chantal
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi "S",
I don't understand exactly what you're trying to do, but there are lots of Swing code samples at the following web sites, so (if you don't already know about them) this may help you:
http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
http://www.codeguru.com/java/Swing/index.shtml
http://www.chka.de/swing/table/
Hope this helps you.
Good Luck,
Avi.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!