我正在使用LWUIT並顯示數據與Table
,比如說航班信息! 而不是寫文字的空運公司,我只是想用圖標替換它們。 所以,我需要覆蓋protected Component createCell(Object value, final int row, final int column, boolean editable)
方法Table
。通過添加一個圖像組件添加到表格單元`createCell`
這是怎麼了,我實現:
初始化
imgAln[i]=null;
try {
imgAln[i] = Image.createImage(strPathToImage[i]);
//e.g /uta.png,/somonair.png and so on
lAln[i] = new Label(imgAln[i]);
} catch (IOException e) { }
創建表對象
Table table = new Table(model) {
protected Component createCell(Object value, final int row,
final int column, boolean editable) {
final Component c = super.createCell(value, row, column, editable);
if (column == 6) {
return lAln[value]; //it does not work here
}
}
};
需要幫助的圖像添加到表格單元格!
有沒有例子?鏈接歡迎!
非常感謝你Vimal!完美的工作示例!有用!至於你推薦我的演示例子,我現在仔細查看它!謝謝!這裏是一個截圖http://www.flickr.com/photos/[email protected]/6525971703/in/photostream – 2011-12-17 15:43:57