Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help me out in JTable Cell creation

 
AjayKumar Kanukuntla
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i tried to create a JTable where in, i got only one column and several rows.
the problem is, i want to display a line of text in each row, and in that string, i want to make some portion italic/bold.
i could only display the string in table. but i could not find a way to make some portion of it bold/italic.
Plz do help me out.
Mail me
 
Thomas Suer
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tables default cell renderer is inherited from JLabel. JLabel doesn't meet your requirements. So, 'all' you have to do is to implement your own cell renderer, that is extending an appropriate gui component (I suppose JEditorPane or JTextPane would be the right one???) and implementing the TableCellRenderer interface. http://java.sun.com/docs/books/tutorial/uiswing/components/text.html http://java.sun.com/j2se/1.3/docs/api/javax/swing/table/TableCellRenderer.html
Tom
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic