/** Toggles the value of the boolean under the current selection. */ private void toggleValue() { int col = fieldTable.getSelectedColumn(); int row = fieldTable.getSelectedRow(); Object v = (Boolean) fieldTable.getModel().getValueAt(row, col); Boolean value = Boolean.valueOf(false); if (v != null) value = (Boolean) v; boolean newValue = !(value.booleanValue()); fieldTable.getModel().setValueAt(Boolean.valueOf(newValue), row, col); model.getDrawingView().repaint(); }
/** * Sets the passed color to the currently selected cell. Returns the selected row. * * @param c The color to set. */ int setCellColor(Color c) { int col = fieldTable.getSelectedColumn(); int row = fieldTable.getSelectedRow(); fieldTable.getModel().setValueAt(c, row, col); return row; }