This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting classCastException while using DefaultTableModel  RSS feed

 
Sowmiya Selvamani
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I m using NetBeans5.5

When I run the below code I got the exception as




Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String
at javax.swing.table.DefaultTableModel.justifyRows(DefaultTableModel.java:242)
at javax.swing.table.DefaultTableModel.setDataVector(DefaultTableModel.java:198)
at javax.swing.table.DefaultTableModel.<init>(DefaultTableModel.java:133)
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DefaultTableModel's first Vector should contain Vectors that contain Strings, not contain the Strings themselves.

If you change

into

it should work.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!