void message(String str) { try { output.insertRow(-1, new String[] {"<I>" + str + "</I>"}); } catch (Jaxception ex) { ex.printStackTrace(); } }
void addItem(String item, String description) { try { if (item == null || item.equals("")) { showMessageDialog("Item field is empty"); return; } if (description == null || description.equals("")) { showMessageDialog("Description field is empty"); return; } table.insertRow(-1, new String[] {item, description}); nameField.setValue(""); descriptionField.setValue(""); // Enable cell editing. table.enableCellEditing(-1, 0, -1, 1, false, false, null); // Add "delete" button. table.addDeleteButtons(-1, -1, null, null); } catch (Jaxception ex) { ex.printStackTrace(); } }
public TableSample() { try { // Add in a header. table.insertRow(0, new String[] {"<B>Item</B>", "<B>Description</B>", " "}); // Put in some initial data for (int i = 0; i < sampleData.length; i++) table.insertRow(-1, sampleData[i]); // Enable in-place editing. table.enableCellEditing(1, 0, -1, 1, false, false, null); // Add "delete" buttons. table.addDeleteButtons(1, -1, null, null); } catch (Jaxception ex) { ex.printStackTrace(); } }