Thursday, April 3, 2008

JTable : Adding Cell Listeners, Getting cell values

Here I intend to show you a sample program which demonstrates how to get the values edited by user in JTable. This is accomplished by using the CellEditorListener Interface. Note the Table Header, Column values, the font type and font size is set custom.This sample program also has the ability to retrieve data from the cell, by mentioning the row and column.

Have a look on these API's that I have used specific for getting the results I just mentioned above
1) javax.swing.event.CellEditorListener

2) javax.swing.event.ChangeEvent
3) javax.swing.table.TableCellEditor

4) javax.swing.table.JTableHeader

Click here to view the code : JTableDemo (2)

Sample screenshots while executing the program