I have a JTable that uses a DefaultTableModel, I got the result in the array but after the execution of the for loop, int i
will always print zero value. The loop is working fine.
Ramalan forecast = model.ramalan(12);
DefaultTableModel tb = new DefaultTableModel();
String header[] = new String[] { "No", "tgl", "harga", "Batas Atas", "Batas Bawah" };
tb.setColumnIdentifiers(header);
Vector<Object> rml = new Vector<>();
for(int i=0; i<forecast.estimasiPoin().ukuran(); i++){
rml.add(i);
rml.add("");
rml.add(aturDesim.format(forecast.estimasiPoin().pada(i)));
rml.add(aturDesim.format(forecast.intervalPrediksiAtas().pada(i)));
rml.add(aturDesim.format(forecast.intervalPrediksiAtas().pada(i)));
tb.addRow(rml);
}
tableRamal.setModel(tb);
Here's how it's supposed to print the values:
for(int i=0; i<12; i++){
rml.add(i);
rml.add("");
rml.add(aturDesim.format(forecast.estimasiPoin().pada(i)));
rml.add(aturDesim.format(forecast.intervalPrediksiAtas().pada(i)));
rml.add(aturDesim.format(forecast.intervalPrediksiAtas().pada(i)));
tb.addRow(rml);
}
tableRamal.setModel(tb);
but it is still returning zero.