Solved

JTable setValueAt not being executed

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
splitOdd10 challenge 5 108
JList custom Cell Renderer refresh 15 57
table example 4 29
hibernate example using maven 12 42
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

810 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