http://imagej.273.s1.nabble.com/toggle-ActionBar-AlwaysOnTop-and-the-API-tp3693618p3693619.html
isAlwaysOnTop method of the Window class.
WindowManager.getFrame(title).setAlwaysOnTop(!WindowManager.getFrame(title).isAlwaysOnTop());
it will set 'alwaysontop' to 0 if it's 1, and 1 if it's 0.
Now about the API, ImageJ's API only contains ImageJ specific information.
java.awt.Window class. You can find these in the Java API at
finally the 'Window' class. Here you find all available information about
java.awt.Windows and what you can do with these.
Frame). This is possible because the java.awt.Frame class is a subclass of
Windows.
Jerome.
> Jerome,
>
> Thank you for the javascript to close an ActionBar. With that instructive
> example in hand, I was able to determine the call to keep an ActionBar
> window on top:
>
> WindowManager.getFrame(title).setAlwaysOnTop(true);
>
> This brings two questions to mind.
>
> 1. I did not find the setAlwaysOnTop() method in the ImageJ API, whereas I
> did find the dispose() method. I use the macro language (but not Java) and
> can see that using javascript to make calls to the API empowers the macro
> language greatly. But how does someone with no Java background go about
> identifying available methods like setAlwaysOnTop() that are not present in
> the API?
>
> 2. How does one access the boolean value of setAlwaysOnTop(), using
> javascript? I found the js valueOf() method will pull it out, but only if
> it is known beforehand. I want to toggle this, and wrote a macro to do so
> using a dialog checkbox. Below is a generic dialog version, a variation of
> which I call from a button in an ActionBar. A true toggle function that
> reads, then toggles, the boolean value would be preferable.
>
>
> // for windows other than 'ImageJ'
> Dialog.create("Toggle window 'AlwaysOnTop'");
> Dialog.addMessage("Enter a window's title and set its 'AlwaysOnTop'
> status.\n The title is the name which appears in the title bar.\n ");
> Dialog.addString("Window title" "", 20);
> Dialog.addMessage("");
> Dialog.addCheckbox(" if checked, this window will remain above all
> other windows", false);
> Dialog.addMessage("");
> Dialog.show();
>
> title = Dialog.getString;
> topStatus = Dialog.getCheckbox;
>
> jsTop = 'title="'+title+'";'+
> 'WindowManager.getFrame(title).setAlwaysOnTop(true);';
>
> jsNotTop = 'title="'+title+'";'+
> 'WindowManager.getFrame(title).setAlwaysOnTop(false);';
>
> if (topStatus==1)
> eval('script',jsTop);
> else eval('script',jsNotTop);
> ____________
>
>
> Regards,
> Bruce
>
>
>
>
> On Wed, Feb 11, 2009 at 5:27 PM, Jerome Mutterer
> <
[hidden email]>wrote:
>
> > Dear Bruce,
> >
> > You can close an ActionBar using javascript, and you can call javascript
> > from a macro with the eval function. This will look like this:
> >
> > title = 'Demo'; // the ActionBar's title
> > if (isOpen(title)) {
> > js ='title="'+title+'";'+
> > 'WindowManager.getFrame(title).dispose();'+
> > 'WindowManager.removeWindow(WindowManager.getFrame(title));';
> > eval ('script',js);
> > }
> >
> > Sincerely,
> >
> > Jerome
> >
> >
> > On Wed, Feb 11, 2009 at 11:34 PM, b holi <
[hidden email]> wrote:
> >
> > > Can ActionBar windows be closed programmatically?
> > >
> > >
> > > Regards,
> > >
> > > Bruce
> > >
> >
>