栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Lwuit中的动态表

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Lwuit中的动态表

请参阅此示例代码。我已使用此代码使用LWUIT创建了动态表。

    Form form = new Form();    form.setLayout(new BorderLayout());    ValueBeans[] valueBeans = new ValueBeans[size];         // Here you can use Bean array value. This array contains collection of bean class.     // You can get the values from this beans class.     // You need to create dynamically with your own staff    Object[][] arrObj = new Object[valueBeans.length, 3];    TableModel model = new DefaultTableModel(new String[]{"Column 1", "Column 2", "Column 3"}, arrObj) {      public boolean isCellEditable(int row, int col) {        return false; // return true if editable cell         }      };for (int index = 0; index < rowValues.size(); index++) {      model.setValueAt(index, 0, valueBeans[index].getValue1()); // row , column , value    model.setValueAt(index, 1, valueBeans[index].getValue2());     model.setValueAt(index, 2, valueBeans[index].getValue3()); }    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);    c.setFocusable(false);    return c;     }    };    table.setScrollable(false);    form.addComponent(BorderLayout.CENTER, table);


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/574051.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号