Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable cells change to JTextField  RSS feed

 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How do I change cells of my JTable to be of type JTextField?
thanks,
Alex
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex,
Look here for some good examples.
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
Regards,
Manfred.
 
Kripal Singh
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
You can display any JComponent in your JTable Cell
Follow the example at
http://www.codeguru.com/java/articles/162.shtml
hope this helps
thanks
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you want the TextField to be visible every time then write your own TableCellRenderer extending JTextField implementing TableCellRenderer. if you want it to be visible only during the editing mode then implement the TableCellEditor. see the swing tutorial at java.sun.com.
chantal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!