Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable with default table model give me strings

 
Mohamad Samy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the first topic for me in this forum and won't be the last. I've been recommended with this forum as the more helpful one from java experienced professionals.

I am facing a problem while creating a table with default table model and using the group layout to lay all the components on the frame
all the things are okay for compiling the program as I want but the problem is that all the components included in my table are displayed as strings, I want to know the reason without using other layout manager



 
Rob Camick
Ranch Hand
Posts: 2580
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, by default, all data is treated as a String. Did you read the JTable API and follow the link on How to Use Tables for an explanation and examples of using a table? The section on Creating a Table Model talks about this issue. Of course you don't need to create a completely new model, you can just extend the DefaultTableModel and override the appropriate method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic