• 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

JTable

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am experiencing a weird problem while compiling a program related to JTable.
I am overriding getValueAt( int , int ) of AbstractTableModel class. Here is the implemnattion of the method:
public Object getValueAt(int nRow, int nCol) {
if (nRow < 0 | | nRow >= getRowCount())
return "";
StockData row = (StockData)m_vector.elementAt(nRow);
switch (nCol) {
case 0: return row.m_symbol;
case 1: return row.m_name;
case 2: return row.m_price;

}
return " ";
}
Every time I compile the program I am getting the following compilation error:
The method Object getValueAt(int, int) declared in class StockTableData cannot override the method of the same signature declared in class javax.swing.table.AbstractTableModel. They must have the same return type.
public Object getValueAt(int nRow, int nCol) {

And the strange thing is that I am able to compile and run this program successfully on the other machine.
I have copied this program from the text book and trying to learn JTable concepts.
Regards,
Milind

[This message has been edited by Milind Kulkarni (edited August 14, 2000).]
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your declaration sure looks legal. I'm guessing that somehow there's more than one version of one of these classes on your machine. Try deleting all .class files and recompiling. Study your CLASSPATH carefully to see if there are any other directories on your machine which are getting picked up which might have alternate versions of the files. If that's not it, I have no idea. Good luck...
 
Milind Kulkarni
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to resolve this problem by narraowing down the CLASSPATH to point to my working directory and deleting all the .class files. I think that there was more than one version of .class files floating somewhere.
Regards,
Milind

[This message has been edited by Milind Kulkarni (edited August 15, 2000).]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic