@Override public void propertyChange(PropertyChangeEvent e) { int threshold = 40; int histIntensity = Integer.parseInt(e.getNewValue().toString()); // check if the value is within the threshold long enough and change to IR if needed if (histIntensity < threshold) { darkHistCounter++; if (darkHistCounter > 300) { viewer.setDrawRGB(false); darkHistCounter = 0; } } }