问题
I am trying to create a LWUIT Table in my J2ME application where all cells in one column are of a particular type e.g. TextField taking decimal input.
Could anyone please suggest of achieving this or even another approach I could take?
回答1:
I was looking in the wrong area.
Instead of using ListCellRenderer
I extended the Table object and overrode the createCell
method.
public class CustomTable extends Table{
public CustomTable(TableModel model) {
super(model);
}
protected Component createCell(Object value, int row, int column, boolean editable) {
switch (column) {
case QUANITY_COLUMN:
// create custom cell and return
...
default:
return super.createCell(value, row, column, editable);
}
}
}
来源:https://stackoverflow.com/questions/2804919/custom-creation-of-cells-in-a-lwuit-table-in-j2me