This discussion is archived
4 Replies Latest reply: Aug 22, 2012 4:18 AM by 800268 RSS

What is the problem with this table editor code?

814246 Newbie
Currently Being Moderated
im using JButton as TableCellEditor component. When I clicked on button nuthing happens.
Tell me where im wrong?
public class Abc extends AbstractCellEditor implements TableCellEditor{
    private JButton btnSearch ;
    private BCD ref;
    private JTable table;

    public DraggedTextSearchEditor(BCD o,JTable tab){
        this.ref = o;
        this.table = tab;
        btnSearch = new JButton();
        btnSearch.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                ref.search();
            }
        });
    }
    
    @Override
    public Component getTableCellEditorComponent(JTable table,Object value
            ,boolean isSelected,int row,int col)
    {
        return btnSearch;
    }

    public Object getCellEditorValue(){
        return btnSearch;
    }
//    public Object getCellEditorValue(){
//        return null;
//    }

}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points