Question

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?

Was it helpful?

Solution

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);
        }
    }

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top