문제

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?

도움이 되었습니까?

해결책

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

}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top