[ImageJ-devel] Instantiation Questions
Johannes Schindelin
Johannes.Schindelin at gmx.de
Mon Aug 16 19:34:05 CDT 2010
Hi,
On Mon, 16 Aug 2010, Grant B. Harris wrote:
> 1) The NewImage() constructor invokes openImage().
> Only call to it seems to be in ij.Commands, if (cmd.equals("new")) new
> NewImage();
> Any reason not to call it this way?
> (new NewImage()).openImage();
> It would be convenient if there were a typical no-args constructor for this.
I guess that the design was to keep things flexible. If NewImage() can be
changed without changing the caller, that's good.
Besides, you can skip the extra parentheses: new Image().openImage() would
be enough.
> 2) Menus changed at some point recently to have an instance field and a
> constructor. What were the reasons for this?
That was probably my doing, even if the effort was not successful: There
are still static member variables. My intention was to make the whole
thing more object oriented (even if there is no chance at the moment to
have multiple instances of ImageJ running in the same process -- as would
be required to run multiple applets in the same webpage -- it would be a
small step towards that goal).
Hth,
Johannes
More information about the ImageJ-devel
mailing list