Question: Hey trying to write a program about Conways game of life using a gui. Trying to make it work using Java's application window like this.
Hey trying to write a program about Conways game of life using a gui. Trying to make it work using Java's application window like this.
import java.awt.EventQueue;
import javax.swing.JFrame;
public class ConwaysGameOfLife {
private JFrame frame;
/** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { ConwaysGameOfLife window = new ConwaysGameOfLife(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
/** * Create the application. */ public ConwaysGameOfLife() { initialize(); }
/** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
}
I would prefer it to have a grid in the center that can be of any size based on user input that would run the simulation but I have yet to make this work.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
