AbstractTableModel and cell editor

carhartt502

New Member
The example i have found:http://www.java2s.com/Code/Java/Swing-Components/ButtonTableExample.htmshow how to create a JTable with specified column (button). It works properly, but the my problem is, that i need to use AbstractTableModel instead of DefaultTableModel (as at the example shows).So i created my own TableModel, which extends AbstractTableModel:\[code\]public class TableModel extends AbstractTableModel {//..
}\[/code\]and replaced:\[code\] DefaultTableModel dm = new DefaultTableModel();dm.setDataVector(new Object[][] { { "button 1", "foo" }, { "button 2", "bar" } }, new Object[] { "Button", "String" });JTable table = new JTable(dm);\[/code\]for:\[code\]JTable table = new JTable(new TableModel());\[/code\]And then nothing happens, when i will click button at some row. Any suggestions?
 
Top