public void stateChanged(ChangeEvent e) {
		if (model.getLightSource() == null)
			return;
		Object o = e.getSource();
		if (o instanceof JSlider) {
			JSlider source = (JSlider) o;
			if (!source.getValueIsAdjusting()) {
				model.setLightSourceInterval((int) ((200 + (source.getMaximum() - source.getValue()) * 20) / model
						.getTimeStep()));
				model.notifyChange();
			}
		}
		else if (o instanceof JSpinner) {
			JSpinner source = (JSpinner) o;
			Object v = source.getValue();
			if (v instanceof Number) {
				int i = (int) ((Number) v).doubleValue();
				SpinnerModel spinnerModel = source.getModel();
				if (spinnerModel instanceof SpinnerNumberModel) {
					Comparable c = ((SpinnerNumberModel) spinnerModel).getMaximum();
					if (c instanceof Number) {
						double x = ((Number) c).doubleValue();
						model.setLightSourceInterval((int) ((200 + (int) ((x + 1 - i) * 20)) / model.getTimeStep()));
						model.notifyChange();
					}
				}
			}
			else {
				System.err.println("Incorrect spinner value");
			}
		}
	}