MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / setVisible

Method setVisible

src/org/opensourcephysics/tools/DataTool.java:2231–2251  ·  view source on GitHub ↗
(boolean vis)

Source from the content-addressed store, hash-verified

2229 }
2230
2231 @Override
2232 public void setVisible(boolean vis) {
2233 // set preferred size the first time shown
2234 if (contentPane.getPreferredSize().equals(dim)) {
2235 double f = 1 + (0.2 * FontSizer.getLevel());
2236 Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
2237 int w = Math.min(screen.width - 40, (int) (dim.width * f));
2238 int h = Math.min(screen.height - 100, (int) (dim.height * f));
2239 // add one pixel to width so no longer equals dim
2240 contentPane.setPreferredSize(new Dimension(w, h + 1));
2241 pack();
2242 // center this on the screen
2243 Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
2244 int x = (dim.width - getBounds().width) / 2;
2245 int y = (dim.height - getBounds().height) / 2;
2246 if (!standAlone)
2247 setLocation(x, y);
2248 }
2249
2250 super.setVisible(vis);
2251 }
2252
2253 /**
2254 * Gets the fit builder.

Callers 1

actionPerformedMethod · 0.95

Calls 7

getLevelMethod · 0.95
minMethod · 0.80
equalsMethod · 0.65
setVisibleMethod · 0.65
getPreferredSizeMethod · 0.45
getBoundsMethod · 0.45
setLocationMethod · 0.45

Tested by

no test coverage detected