Solved

JTable setValueAt not being executed

Posted on 2003-11-03
4
1,659 Views
Last Modified: 2010-05-18
Hello,

   I am extending "AbstractTableModel" using Java 1.3.  I can double click on a cell and enter data into the JTable, but all of the entered data disappears when I double click a different cell ("change editing focus").  "setValueAt" is not executed, but "isCellEditable" is executed.  A snippet of the "AbstractTableModel" is listed below:



public boolean isCellEditable(int row, int col){ return true; }

public void setValueAt(Object aValue,int rowIndex, int colIndex) {
       data[rowIndex][colIndex] = (aValue==null?aValue:aValue.toString());;
       fireTableCellUpdated(rowIndex, colIndex);
}
0
Comment
Question by:rmundkowsky
4 Comments
 
LVL 92

Expert Comment

by:objects
ID: 9675509
How do you know setValueAt() is not getting called.

Can you post your getValueAt() method.
0
 
LVL 1

Accepted Solution

by:
allelopath earned 500 total points
ID: 9675690
Have you implemented your own CellEditor?
If so, make sure that you are calling cancelCellEditing() and stopCellEditing().



 
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9677963
>>I am extending "AbstractTableModel" using Java 1.3

You may well find that extending DefaultTableModel is much easier as the basic functionality is already implemented for you.
0
 

Author Comment

by:rmundkowsky
ID: 9679931
Found my problem,  I was overloading "editingStopped" when I extended JTable.  Thank you all for you inputs.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
powerN  challenge 3 47
array11 challenge 16 51
wordcount challenge 11 76
what is the difference between "sudo su" and "su - root" 6 75
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now