I just created a new non-modal dialog which implements PlugIn and
properly installs itself in the Plugins menu at start up. When the Dialog is open, however, it does not appear in the Window list of ImageJ although the process is clearly running within ImageJ. Q: Does my plugin class need to extend PlugInFrame in order to appear in the Window menu when open? Thank, Bill |
Hi Bill,
when creating the frame, you need code like this in a PlugInFrame: this.setTitle(myTitle); WindowManager.addWindow(this); And when closing /** Overrides the superclass close method */ public void close () { WindowManager.removeWindow(this); super.close(); } If you don't have a PlugInFrame, I suspect that it would work the same way, with 'this' replaced by the reference to the frame. You will have to detect the 'Frame closed' event to remove your frame from the list - having a PlugInFrame is a simple solution for this (see the code above). Michael ________________________________________________________________ On 1 Jun 2009, at 16:03, Bill Mohler wrote: > I just created a new non-modal dialog which implements PlugIn and > properly installs itself in the Plugins menu at start up. When the > Dialog is open, however, it does not appear in the Window list of > ImageJ although the process is clearly running within ImageJ. > > Q: Does my plugin class need to extend PlugInFrame in order to > appear in the Window menu when open? > > Thank, > Bill |
Hi Bill,
oops, sorry, a correction is necessary (it took me a while to notice). Unless you need other code in the close method, you don't need the public void close() method. ij.plugin.frame.PlugInFrame has a close method that removes the frame from the Window Manager. Michael ________________________________________________________________ On 2 Jun 2009, at 11:22, Michael Schmid wrote: > Hi Bill, > > when creating the frame, you need code like this in a PlugInFrame: > > this.setTitle(myTitle); > WindowManager.addWindow(this); > > And when closing > > /** Overrides the superclass close method */ > public void close () { > WindowManager.removeWindow(this); > super.close(); > } > > If you don't have a PlugInFrame, I suspect that it would work the > same way, with 'this' replaced by the reference to the frame. You > will have to detect the 'Frame closed' event to remove your frame > from the list - having a PlugInFrame is a simple solution for this > (see the code above). > > Michael > ________________________________________________________________ > > On 1 Jun 2009, at 16:03, Bill Mohler wrote: > >> I just created a new non-modal dialog which implements PlugIn and >> properly installs itself in the Plugins menu at start up. When the >> Dialog is open, however, it does not appear in the Window list of >> ImageJ although the process is clearly running within ImageJ. >> >> Q: Does my plugin class need to extend PlugInFrame in order to >> appear in the Window menu when open? >> >> Thank, >> Bill > |
Thanks, Michael. This indeed what I have found. Very easy.
Bill >Hi Bill, > >oops, sorry, a correction is necessary (it took me a while to notice). > >Unless you need other code in the close method, you don't need the >public void close() method. >ij.plugin.frame.PlugInFrame has a close method that removes the >frame from the Window Manager. > > >Michael >________________________________________________________________ > >On 2 Jun 2009, at 11:22, Michael Schmid wrote: > >>Hi Bill, >> >>when creating the frame, you need code like this in a PlugInFrame: >> >> this.setTitle(myTitle); >> WindowManager.addWindow(this); >> >>And when closing >> >> /** Overrides the superclass close method */ >> public void close () { >> WindowManager.removeWindow(this); >> super.close(); >> } >> >>If you don't have a PlugInFrame, I suspect that it would work the >>same way, with 'this' replaced by the reference to the frame. You >>will have to detect the 'Frame closed' event to remove your frame >>from the list - having a PlugInFrame is a simple solution for this >>(see the code above). >> >>Michael >>________________________________________________________________ >> >>On 1 Jun 2009, at 16:03, Bill Mohler wrote: >> >>>I just created a new non-modal dialog which implements PlugIn and >>>properly installs itself in the Plugins menu at start up. When the >>>Dialog is open, however, it does not appear in the Window list of >>>ImageJ although the process is clearly running within ImageJ. >>> >>>Q: Does my plugin class need to extend PlugInFrame in order to >>>appear in the Window menu when open? >>> >>>Thank, >>>Bill |
Free forum by Nabble | Edit this page |