Login  Register

Re: Need to close the result table from my java application

Posted by EHB2010 on Mar 18, 2010; 1:27pm
URL: http://imagej.273.s1.nabble.com/Need-to-close-the-result-table-from-my-java-application-tp3687988p3688002.html

too easy!!

in all seriousness
1) I thought it might be useful to be able to make it visible very simply again with the measurements intact. You can always call reset() on the table if you want it clear.
2) Frame doesn't have a "close()" method so I think you would have to cast it to its subtype TextWindow, which is even more wordy:

        Frame[] arrayOfFrames = WindowManager.getNonImageWindows();
        for (int i = 0 ; i < arrayOfFrames.length ; ++i) {
                String localName = arrayOfFrames[i].getTitle();
                if ( localName.equalsIgnoreCase("Results")){
                        TextWindow tw = (TextWindow) arrayOfFrames[i];
                        tw.close();
                }
        }
[is there a way of getting a TextWindow object directly?? ]
3) close() would ask if you wanted to save the data. If you're not interested in the data that could be annoying.
4) I don't know much about the plugins being used but I thought there was a risk that they'd keep recreating the results table when they were re-run and it'd keep popping up. Although I guess there's the same risk with setVisible().
5) I don't think it would save that much memory to clear the table and dispose() of the window.