Login  Register

Problems with updateAndRepaintWindow

Posted by Litanol on Jun 03, 2010; 7:28pm
URL: http://imagej.273.s1.nabble.com/Problems-with-updateAndRepaintWindow-tp3688065.html

Hello!

I've been trying for 2 days using the updateAndRepaintWindow function in my code, but it won't work!
Here's my code:

        private class MyChangeListener implements ChangeListener
        {
                public void stateChanged(ChangeEvent changeEvent)
                {
                        JSlider slider = (JSlider) changeEvent.getSource();
                       
                        // Need to divide the value with 100 so it turns to a float value (from int, because JSlider uses only int)
        multiplierForThreshold = (float) (slider.getValue() / 100.0);
        findMultiplierTextField.setText(Float.toString(multiplierForThreshold));
       
        if (!slider.getValueIsAdjusting()) {

        // Threshold the image with the value of multiplierForThreshold which has been chosen by JSlider
        // I've created the StackThresholder class myself. In brief, it sets a threshold for a image stack
                  StackThresholder myStackThresholder = new StackThresholder(multiplierForThreshold);
                                imp = myStackThresholder.threshold (originalImages, 9);
                               
                                // Making the image show up only one time
                                if(showCounter == 0)
                                {
                                        imp.show();
                                        showCounter++;
                                }
                               
                                // Makes the images using black-white mode somehow
                                imp.setStack(imp.getStack ());
                               
                                imp.updateAndRepaintWindow();
// imp.show();
                }
                }
        }


It works fine to update the image sequence by using "imp.show();", but I don't want it to pop-up a new window everytime a choose a new "multiplierForThreshold".

So, how can I make this work with "imp.updateAndRepaintWindow();" instead?


// Litanol