This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable" Watch "JTable" New topic
Author

JTable

Milind Kulkarni
Ranch Hand

Joined: Jun 01, 2000
Posts: 146
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).]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
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...


"I'm not back." - Bill Harding, Twister
Milind Kulkarni
Ranch Hand

Joined: Jun 01, 2000
Posts: 146
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).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable
 
Similar Threads
JTABLE getValueAt compiling error
erratic scrolling behavior with JTable with variable height rows
JTable Dynamic - Urgent
Refresh JTable with New data
JTable not working with tableChanged