Posted by
Wayne Rasband-2 on
URL: http://imagej.273.s1.nabble.com/plot-window-bug-tp5022945p5022954.html
> On Feb 14, 2020, at 12:23 AM, Fred Damen <
[hidden email]> wrote:
>
> Greetings,
>
> One of the plugins that I am developing, that plots several plots of
> requested size and location, all of a sudden decided to start ignoring the
> requested plot size plot.setSize(xl,yl); and decided to scale the plot
> inappropriately.
The latest ImageJ daily build (1.52u11) adds a plot.setWindowSize(width,height) method that sets the window size before the plot is displayed. It should work more reliably because it avoids potential race conditions. Here is a JavaScript example:
plot = new Plot("title","X","Y");
plot.setWindowSize(600, 300);
win = plot.show();
win.setLocation(100,100);
-wayne
> To my knowledge I did not change anything with the
> plotting, or, X windows / Gnome (Fedora 31) or up/down grade ImageJ
> (currently 1.52r). The symptoms seem to be the same as I mentioned about
> ages ago on MacOS. The PlotWindow will seem to size itself correctly, on
> the next plotwindow.drawPlot(plot) after resizeing the window using the
> mouse; frustrating to say the least.
>
> A partial work around is to set the size of the plotwindow instead and
> call plotwindow.windowactivated. Then the second time you do the
> plotwindow.drawplot(plot) the plotwindows will be the requested size and a
> scale of 1. Although the plotwindow.getSize() and the actual size of the
> gnome adorned window are not the same; whereas the
> imp.getWindow().getSize() is the size of the gnome adorned window. (Useful
> if you want to layout the windows on the screen in a matrix type fashion)
>
> not the exact code, but is easy to understand then my prose ...
>
> Plot plot = new Plot("title","X","Y");
> plot.setSize(600, 300);
> PlotWindow plotwindow = plot.show();
> // The plot is not the write size or scale
> plot.window.setSize(600,300);
> Dimension pwDim = plotwindow.getSize();
> plotwindow.setLocation(sx,sy);
> plotwindow.windowActivated(null);
> plotwindow.drawPlot(plot);
> // window size seems to be the smallest allowed, albeit the scale seem to
> be 1
> plotwindow.drawPlot(plot);
> // windowsize is as requested, although...
> // plotwindow2.setLocation(sx+pwDim.width,sy); // overlaps, is short in x
> by 10 pixels
> // plotwindow2.setLocation(sx,sy+pwDim.height); // overlays, is short in y
> by 100 pixels
> // works for ImageWindow(s)
>
> Fred
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html