2010-05-10 63 views
0

我想在我的J2ME應用程序中創建一個LWUIT表格,其中一列中的所有單元格都是特定類型,例如TextField採用十進制輸入。在J2ME的LWUIT表中自定義創建單元格

任何人都可以請建議實現這個,甚至可以採取另一種方法嗎?

回答

3

我在找錯地方。

而不是使用ListCellRenderer我擴展了表格對象並覆蓋了createCell方法。

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

} 
+0

你可以建議任何關於如何爲表格中的一行添加點擊或選擇列表? – 2013-10-31 09:02:52