Custom creation of cells in a LWUIT Table in J2ME

ⅰ亾dé卋堺 提交于 2019-12-25 03:36:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!