import javax.swing.DefaultListModel; /** * DoubleListModel is the model for the DoubleList class. * It overrides a couple of methods so that only Doubles are * placed into it. * * @author Stuart Hansen * @version September 2008 */ public class DoubleListModel extends DefaultListModel { // Overrides add element so that only Doubles are added public void addElement(Object obj) { Double d = Double.parseDouble(obj.toString()); addElement(d); } // A specialized addElement for Doubles public void addElement(Double d) { super.addElement(d); } // Overrides toArray() so that the returned Array contains Doubles public Double[] toArray() { Object[] tempArr = super.toArray(); Double[] dArr = new Double[tempArr.length]; for (int i=0; i