Hi everyone,
I got a small problem with my JList with MULTIPLE INTERVAL SELECTION.
When i click on a item it adds the price to the total and when i ctrl+click another item it again adds the price to the total
Then problem is when i deselect one of the selected items it adds the price to the total again.
Is there someway to subtract the selected items price from the total?.
Heres a snippet of code.

JListList  tempList = new JList(list);

public void valueChanged(ListSelectionEvent  evt) {
	int minIndex = tempList .getMinSelectionIndex();
	int maxIndex = tempList .getMaxSelectionIndex();
		for (int i = minIndex; i <= maxIndex; i++) {
		   if (evt.getValueIsAdjusting() == false & toppingList.isSelectedIndex(i)) {
				double extra = 1.1;
				double item = Double.parseDouble(itemprice.getText());
				price = item + extra;
				String res = Double.toString(price);


Recalculate the price after a selection change.

public void valueChanged(ListSelectionEvent evt){
        if (!evt.getValueIsAdjusting()){
            price = basePrice;
            if (evt.getSource() instanceof JList){
                JList list = (JList)evt.getSource();                
                for(Object value : list.getSelectedValues()){
                    //price += value;