Hello there,
I am working on a ImageJ plugin which does some calculations on a given image and then tries to reduce its colors. The user can control the number of the compression factor by a Swing JSlider, which is placed on a JFrame. So there is a ChangeListener for the JSlider which triggers the core function of the plugin and then sends the result to an ImagePlus. (So it is a kind of a full preview). This works fine - until I remove every call to IJ.log(). If I remove every call to IJ.log() then the plugin won't work or won't reliably work. It is a strange behaviour, it seems like the function isn't triggered.
s.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
JSlider s = (JSlider) e.getSource();
if (!s.getValueIsAdjusting()) {
IJ.log("foobar"); // do not remove me or I'll break your whole plugin
reduceColors(imageProcessor, s.getValue());
}
}
});
Not weird enough? Okay, it seems like it is not the call to IJ.log() which makes the difference. Apparently, it is the visibility of the Log Window ... if it is present, everything is fine, if it is not then the slider doesn't seem to work.
Not weird enought? Okay, if I compile and debug the plugin with Netbeans, everything works fine, independent of any IJ window. The slider works much more smooth and for every change the new result will be generated.
Does anyone know, how to fix it?
Best regards
Justus Merten
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html