• Post Reply Bookmark Topic Watch Topic
  • New Topic

Appending blank to to JTable of ArrayList  RSS feed

 
Larry Krigbaum
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've made a JTable of ArrayList and I'm trying to add a blank row to the table when a button is pressed. I've marked the offending line where I get the error

no suitable method found for addRow(Role)
method DefaultTableModel.addRow(Object[]) is not applicable
(actual argument Role cannot be converted to Object[] by method invocation conversion)
method DefaultTableModel.addRow(Vector) is not applicable
(actual argument Role cannot be converted to Vector by method invocation conversion)

This seems pretty obvious, but I have no idea how to fix it. Override addRow? How? Is my problem elsewhere and this is where it gets snagged? Any suggestions would be much appreciated.


The runtime error is: "Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: SMC.RoleCard.RoleTableModel.addRow"


And here's the code...

 
Bin Smith
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FIrst of all use code button to format your code properly. This way it is easier to read.

It causes compilation error due to type mismatch, meaning method addRow accepts one java class or subclass and you try to pass another java class.

I created big, useful tutorial on ArrayList in java as well as on LinkedList. A must to be Junior Java developer !!! Hot topic on any interview !
They will help you to write any Java application efficiently.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!