Since you are using a selection mode of MULTIPLE_INTERVAL_SELECTION
you have to account for all selections. Consider using a method like this to calculate the total.
public int calculateTotalPrice() {
int[] selections = otherPrdctList.getSelectedIndices();
int total = 0;
for (int i : selections) {
total += miscellaneousProdPri[i];
}
return total;
}
Then you can call this from your "Calculate" button press. This approach also does not require that you implement ListSelectionListener
and you can remove your valueChanged
method.