MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / fitToWindow

Method fitToWindow

ij/src/main/java/ij/gui/PlotCanvas.java:165–179  ·  view source on GitHub ↗

Resizes the plot (unless frozen) to fit the window

()

Source from the content-addressed store, hash-verified

163
164 /** Resizes the plot (unless frozen) to fit the window */
165 public void fitToWindow() {
166 if (plot == null || plot.isFrozen()) {
167 super.fitToWindow();
168 return;
169 }
170 ImageWindow win = imp.getWindow();
171 if (win==null) return;
172 Rectangle bounds = win.getBounds();
173 Dimension extraSize = win.getExtraSize();
174 int width = bounds.width-extraSize.width;//(insets.left+insets.right+ImageWindow.HGAP*2);
175 int height = bounds.height-extraSize.height;//(insets.top+insets.bottom+ImageWindow.VGAP*2);
176 //IJ.log("fitToWindow "+bounds+"-> w*h="+width+"*"+height);
177 resizeCanvas(width, height);
178 getParent().doLayout();
179 }
180
181 /** Resizes the canvas when the user resizes the window. To avoid a race condition while creating
182 * a new window, this is ignored if no window exists or the window has not been activated yet.

Callers 1

setLocationAndSizeMethod · 0.45

Calls 6

getExtraSizeMethod · 0.95
resizeCanvasMethod · 0.95
getParentMethod · 0.80
getBoundsMethod · 0.65
isFrozenMethod · 0.45
getWindowMethod · 0.45

Tested by

no test coverage detected