Login  Register

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

Posted by Justus Merten on Jun 03, 2014; 10:36am
URL: http://imagej.273.s1.nabble.com/Re-SOLVED-Plugin-doesn-t-work-correctly-without-log-window-tp5008000.html

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