在J2ME的LWUIT表中自定义单元格的创建 [英] Custom creation of cells in a LWUIT Table in J2ME
本文介绍了在J2ME的LWUIT表中自定义单元格的创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我的J2ME应用程序中创建LWUIT表,其中一列中的所有单元格均为特定类型,例如TextField采用十进制输入.
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.
我没有使用ListCellRenderer
,而是扩展了Table对象并覆盖了createCell
方法.
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);
}
}
}
这篇关于在J2ME的LWUIT表中自定义单元格的创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文