(boolean vis)
| 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. |
no test coverage detected