Java Swing Tutorial - Java DefaultBoundedRangeModel .getChangeListeners ()








Syntax

DefaultBoundedRangeModel.getChangeListeners() has the following syntax.

public ChangeListener [] getChangeListeners()

Example

In the following code shows how to use DefaultBoundedRangeModel.getChangeListeners() method.

import javax.swing.DefaultBoundedRangeModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/*www  .j  a  v a 2s.c  o  m*/
public class Main {
  public static void main(String args[]) {
    DefaultBoundedRangeModel model = new DefaultBoundedRangeModel();
    ChangeListener myListener = new MyChangeListener();
    model.addChangeListener(myListener);
    
    ChangeListener[] lis = model.getChangeListeners();
    

  }
}

class MyChangeListener implements ChangeListener {
  public void stateChanged(ChangeEvent e) {
    System.out.println("A ChangeEvent has been fired!");
  }
}