Wednesday, February 12, 2014

JTable does not display the value set by the setValueAt method

You programmatically set the cell value by calling setValueAt(value, row, column) on the JTable or on the DefaultTableModel and then calling either repaint() method of the JTable  or the fireTableDataChanged() method of the DefaultTableModel. To your surprise, the JTable does not display the value you just set and throws no exception.

 This situation happens if you are currently editing the cell, for example you have double clicked in the cell. You need to call <your table name>.getCellEditor().stopCellEditing() before you programmatically set the value to the cell.
          
-----------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

No comments:

Post a Comment