Re: [SOLVED] Plugin doesn't work correctly without log window

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [SOLVED] Plugin doesn't work correctly without log window

Justus Merten
I am sorry for this, but I figured it out.

Apparently, my Event Dispatch Thread got stuck so I have to use a sepearte thread for my image calculations. So this is the working code.

s.addChangeListener(new ChangeListener() {

    @Override
    public void stateChanged(ChangeEvent e) {
        final JSlider s = (JSlider) e.getSource();
        if (!s.getValueIsAdjusting()) {
            text.setText(s.getValue() + "");
           
            new Thread(new Runnable() {

                public void run() {
                    reduceColors(imageProcessor, s.getValue());
                }
            }).start();
           
           
        }
    }
});

I think the invocation of IJ.log() interrupted the EDT and without this interrupt the GUI got stuck. Is this the right conclusion? Sorry this issue isn't an ImageJ issue anymore it is just caused by my poor Java knowledge.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html