Solved

JTable setValueAt not being executed

Posted on 2003-11-03
4
1,660 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 126
backtracking recursion  code 19 54
servlet  URL Rewriting 1 27
egit plugin on eclipse 8 40
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…

895 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

19 Experts available now in Live!

Get 1:1 Help Now