Login  Register

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

Posted by Rasband, Wayne (NIH/NIMH) [E] on Mar 20, 2010; 6:10pm
URL: http://imagej.273.s1.nabble.com/Need-to-close-the-result-table-from-my-java-application-tp3687988p3687991.html

On Mar 19, 2010, at 5:50 AM, Michael Schmid wrote:

> Hi Bob,
>
> the TextWindow class has a close() method. So you probably need  
> something like the following:
>
>   Frame frame = WindowManager.getFrame("Results");
>   if (frame instanceof TextWindow) {
>     TextWindow textWindow = (TextWindow)Frame;
>     textWindow.close();
>   } else {
>     SOME ERROR HANDLING (either frame=null or there is a non-
> TextWindow window named 'Results')
>   }
>
> TextWindow.close should take care of the rest: If the title is  
> "Results", it puts the results counter to zero and clears the  
> textPanel associated with the results.

In ImageJ 1.43s or later you can close the "Results" window using:

   TextWindow win = ResultsTable.getResultsWindow();
   if (win!=null) win.close();

or use

   TextWindow win = ResultsTable.getResultsWindow();
   if (win!=null) win.close(false);

if you do not want the "save changes" dialog to be shown.

-wayne


>
> Michael
> ________________________________________________________________
>
> On 18 Mar 2010, at 16:34, Bob Loushin wrote:
>
>> @Michael Schmid  Yes, close() would be a great solution, but it  
>> doesn't exist, at least at the level I'm trying to get at it (Frame  
>> class).