• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Appending blank to to JTable of ArrayList

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...

 
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic