Saturday, July 02, 2005

Got the answer about the cell editor

I have tried many ways to solve the cell editor with popup dialog problem. like: use mouse event listener , ListSelection listener,Focus Listener ,extend a AbstractCellEditor,etc. but these don't work. I post my question on the Sun forum. I got a similar sample.
Contrast to my prior work, I found I have use the syntax: myJTable.setCellEditor(new MyCellEditor()) and myJTable.setDefaultCellEditor(String.class,new MyCellEditor()).These two syntax don't work. The syntax in the sample use : myJTable.getColumnModel().getColumn(0).setCellEditor(new MyCellEditor). It does work!! But I still don't know what the difference between them.
Note: MyCellEditor is a CellEditor that I extends the AbstractCellEditor or DefaultCellEditor(Both work).

No comments: