private void seltutto1ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_seltutto1ActionPerformed for (int i = 0; i < tab.getRowCount(); i++) { double qta = CastUtils.toDouble0(tab.getValueAt(i, tab.getColumn("quantità").getModelIndex())); double qta_evasa = CastUtils.toDouble0( tab.getValueAt(i, tab.getColumn("quantità già confermata").getModelIndex())); double qta_da_evadere = qta; tab.setValueAt(qta_da_evadere, i, tab.getColumn("quantità confermata").getModelIndex()); } } // GEN-LAST:event_seltutto1ActionPerformed
public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { try { if (value instanceof Double || value instanceof BigDecimal) { double valMax = CastUtils.toDouble0(table.getValueAt(row, column - 1)); double val = CastUtils.toDouble0(value); spinner.setModel(new SpinnerNumberModel(val, 0d, valMax, 0.1d)); } else { int valMax = CastUtils.toInteger0(table.getValueAt(row, column - 1)); int val = CastUtils.toInteger0(value); spinner.setModel(new SpinnerNumberModel(val, 0, valMax, 1)); } } catch (Exception e) { e.printStackTrace(); } spinner.setValue(value); return spinner; }