public CAStatic(int size) { // size is the size of the area containing cells dsize = size; gSize = size + 2 * maxit; int wscale = 6; // scale for main panel int btnHeight = 480 - 384; // found by trial and error - must be a better way! // experiment = new CAGridStatic(size, maxC); // int tint = (int)Math.ceil((double)(400*maxit)/(double)gSize)+(480-384); // int tint = (int)Math.ceil((double)(400*(50+maxit))/(double)gSize)+(480-384); int tint = (maxit + rowstoDraw) * wscale + btnHeight; // only going to show up to 50 dots in lower panel // add 20 to x and 60 to y bcos not printing onto the full frame setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container mainWindow = getContentPane(); mainWindow.setLayout(new BorderLayout()); setSize(gSize * wscale, tint); buttonHolder = new JPanel(); buttonHolder.setLayout(new GridLayout(2, 2)); SpinnerNumberModel model3 = new SpinnerNumberModel(50, 0, 100, 5); JSpinner spinner3 = new JSpinner(model3); writeBtn = new JButton("Output Results to file"); writeBtn.addActionListener(this); startBtn = new JButton("Start"); startBtn.addActionListener(this); paramsBtn = new JButton("Set Probabilities"); paramsBtn.addActionListener(this); wrapBtn = new JButton("Toggle wrap"); wrapBtn.addActionListener(this); buttonHolder.add(writeBtn); writeBtn.setVisible(false); buttonHolder.add(paramsBtn); buttonHolder.add(wrapBtn); buttonHolder.add(startBtn); mainWindow.add(buttonHolder, BorderLayout.SOUTH); msgBtn = new JTextArea(" Default Parameter Values: " + CAGridStatic.params); msgBtn.setEditable(false); mainWindow.add(msgBtn, BorderLayout.NORTH); CApicture = new CAImagePanel(); CApicture.rowstoShow = rowstoDraw; mainWindow.add(CApicture, BorderLayout.CENTER); // not here - doesn't work: CApicture.setScale(gSize,maxit,scale); // pack(); setVisible(true); setpalette(); iterations = 0; savedvals = new int[maxRun][maxit]; outPrinter = new ResultsPrinter(this); }