the question is :How can i add a button on each row in a table in CODENAME ONE? and as u can see in the line 19 i commented where the code should be to add a button inside col4
Form hi = new Form("Table", new BorderLayout());
TableModel model = new DefaultTableModel(new String[] {"Col 1", "Col 2", "Col 3","col4"}, new Object[][] {
{"Row 1", "Row A", "Row X"},
{"Row 2", "Row B can now stretch", null},
{"Row 3", "Row C", "Row Z"},
{"Row 4", "Row D", "Row K"},
}) {
public boolean isCellEditable(int row, int col) {
return col != 0;
}
};
Table table = new Table(model) {
@Override
protected TableLayout.Constraint createCellConstraint(Object value, int row, int column) {
TableLayout.Constraint con = super.createCellConstraint(value, row, column);
if(column == 3) {
//how can i add a button here on each row ?
}
con.setWidthPercentage(33);
return con;
}
};
hi.add(BorderLayout.CENTER, table);