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) {
        super(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.

windowGreen.firePropertyChange("myColor",windowGreen.oldMaxValue,green.getChannelProcessor().maxValue());

That solved it,

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

                    }

                    @Override
                    public void imageClosed(ImagePlus imagePlus) {

                    }

                    @Override
                    public void imageUpdated(ImagePlus imagePlus) {
                        System.out.println(green.getChannelProcessor().maxValue())
                    }
                };

                greenImage.addImageListener(imageListener);