Java tutorial
import javax.swing.DefaultBoundedRangeModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class Main { public static void main(String args[]) { try { DefaultBoundedRangeModel model = new DefaultBoundedRangeModel(); ChangeListener myListener = new MyChangeListener(); model.addChangeListener(myListener); model.removeChangeListener(myListener); } catch (Exception e) { e.printStackTrace(); } } } class MyChangeListener implements ChangeListener { public void stateChanged(ChangeEvent e) { System.out.println("A ChangeEvent has been fired!"); } }