Adding a listener to a variable change

I am trying to fire an event once I change the maximum threshold of Color Balance Adjustment of any image and listen to that event back.

I extended ImageWindow and added a variable that gets in its constructor the value of the maximum threshold

public class myImageWindow extends ImageWindow {
    public static double oldMaxValue;
public myImageWindow(ImagePlus imp) {
        oldMaxValue = imp.getChannelProcessor().getMax();

I can detect the change using a mouse event

ImagePlus greenImage= WindowManager.getImage(1);
myImageWindow windowGreen = new myImageWindow(green);
windowGreen.addMouseWheelListener(l -> System.out.println(greenImage.getChannelProcessor().getMax()));

Now I want to replace that mouse event by firing an event at every time I am changing the value of the Maximum Color Threshold. I found this method firePropertyChange but how to fire at every change specially that it is window related and not Image related.


That solved it,

ImageListener imageListener = new ImageListener() {
                    public void imageOpened(ImagePlus imagePlus) {


                    public void imageClosed(ImagePlus imagePlus) {


                    public void imageUpdated(ImagePlus imagePlus) {