// This file contains excerpts from the textbook Concrete // Abstractions: An Introduction to Computer Science Using Scheme, by // Max Hailperin, Barbara Kaiser, and Karl Knight, Copyright (c) 1998 // by the authors. Full text is available for free at // http://www.gustavus.edu/+max/concrete-abstractions.html import java.awt.event.*; public class PoltergeistItemListener implements ItemListener { private PoltergeistThread thread; public PoltergeistItemListener(PoltergeistThread t){ thread = t; } public void itemStateChanged(ItemEvent evt){ if(evt.getStateChange() == ItemEvent.SELECTED){ thread.enable(); } else { thread.disable(); } } }