diff --git a/.idea/artifacts/Conways_Game_of_Life_jar.xml b/.idea/artifacts/Conways_Game_of_Life_jar.xml
new file mode 100644
index 0000000..dfefe36
--- /dev/null
+++ b/.idea/artifacts/Conways_Game_of_Life_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/Conways_Game_of_Life_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/src/data/control.gif b/src/data/control.gif
deleted file mode 100644
index 7907ad2..0000000
Binary files a/src/data/control.gif and /dev/null differ
diff --git a/src/data/control1.gif b/src/data/control1.gif
deleted file mode 100644
index 65d5c08..0000000
Binary files a/src/data/control1.gif and /dev/null differ
diff --git a/src/data/control2.png b/src/data/control2.png
deleted file mode 100644
index 15c5779..0000000
Binary files a/src/data/control2.png and /dev/null differ
diff --git a/src/data/controller.png b/src/data/controller.png
deleted file mode 100644
index 0d18b15..0000000
Binary files a/src/data/controller.png and /dev/null differ
diff --git a/src/data/controller.svg b/src/data/controller.svg
deleted file mode 100644
index 6eeced9..0000000
--- a/src/data/controller.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/data/icon.png b/src/data/icon.png
deleted file mode 100644
index c9836ea..0000000
Binary files a/src/data/icon.png and /dev/null differ
diff --git a/src/game/Control.java b/src/game/Control.java
new file mode 100644
index 0000000..2c18bc8
--- /dev/null
+++ b/src/game/Control.java
@@ -0,0 +1,31 @@
+package game;
+
+import gui.GUI;
+
+public class Control {
+
+ private GUI gui;
+
+ private int xSize, ySize, cellCount;
+
+ public Control(){
+
+ gui = new GUI(this);
+
+ gui.buildControlWindow();
+
+ }
+
+ public void buildGameWindow(int xSize, int ySize, int cellCount){
+ this.xSize = xSize;
+ this.ySize = ySize;
+ this.cellCount = cellCount;
+
+
+ gui.buildGameWindow();
+ }
+
+}
+
+
+
diff --git a/src/gui/StartGUI.java b/src/gui/GUI.java
similarity index 77%
rename from src/gui/StartGUI.java
rename to src/gui/GUI.java
index 64c5677..7ee9a27 100644
--- a/src/gui/StartGUI.java
+++ b/src/gui/GUI.java
@@ -1,15 +1,17 @@
package gui;
+import game.Control;
+
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
+import java.awt.event.*;
-public class StartGUI{
+public class GUI {
+
+ private final Control control;
private JFrame jf;
@@ -22,6 +24,7 @@ public class StartGUI{
private JSlider yAxis;
private JLabel yAxisName;
private JLabel yAxisLabel;
+ private int cellCount = 6;
private JSlider startCells;
private JLabel startCellsName;
private JLabel startCellsLabel;
@@ -32,13 +35,18 @@ public class StartGUI{
private JButton manuelStart;
- public StartGUI(){
+ public GUI(Control control) {
+ this.control = control;
+
+ }
+
+ public void buildControlWindow() {
jf = new JFrame();
- jf.setTitle("CT-Conway's Game of Life");
+ jf.setTitle("Conway's Game of Life");
- ImageIcon imageIcon = new ImageIcon("src/data/cotroller.png");
+ ImageIcon imageIcon = new ImageIcon("src/data/PNG/Icon.png");
jf.setIconImage(imageIcon.getImage());
//getContentPane().setBackground(Color.decode("#121212"));
@@ -49,21 +57,19 @@ public class StartGUI{
jf.setAutoRequestFocus(false);
jf.setLayout(null);
jf.setSize(752, 424);
- //jf.getContentPane().setPreferredSize(new Dimension(752, 423));
jf.setResizable(false);
- initComponents();
- addComponents();
+ initControlComponents();
+ addControlComponents();
jf.setLocationRelativeTo(null);
jf.setVisible(true);
-
}
- public void initComponents(){
+ private void initControlComponents() {
Font head = new Font("Segoe UI Light", Font.PLAIN, 24);
Font text = new Font("Segoe UI Light", Font.PLAIN, 16);
@@ -134,9 +140,6 @@ public class StartGUI{
yAxisLabel.setVisible(true);
-
-
-
startCells = new JSlider(6, 6);
startCells.setBounds(180, 210, 200, 20);
startCells.setFont(text);
@@ -145,8 +148,8 @@ public class StartGUI{
startCells.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
- int value = startCells.getValue();
- updateSliderLables(2, value);
+ cellCount = startCells.getValue();
+ updateSliderLables(2, cellCount);
}
});
startCells.setVisible(true);
@@ -170,9 +173,8 @@ public class StartGUI{
public void mouseEntered(MouseEvent e) {
super.mouseEntered(e);
JButton b = (JButton) e.getSource();
- b.setContentAreaFilled(true);
- b.setBackground(Color.decode("#121212"));
- b.setForeground(Color.decode("#F8F8FF"));
+ b.setForeground(Color.decode("#C40233"));
+ b.setBounds(b.getX() - 10, b.getY() - 10, b.getWidth() + 20, b.getHeight() + 20);
}
@Override
@@ -180,7 +182,7 @@ public class StartGUI{
super.mouseExited(e);
JButton b = (JButton) e.getSource();
b.setForeground(Color.decode("#121212"));
- b.setContentAreaFilled(false);
+ b.setBounds(b.getX() + 10, b.getY() + 10, b.getWidth() - 20, b.getHeight() - 20);
}
};
@@ -189,42 +191,51 @@ public class StartGUI{
randomStart.setText("Random Start");
randomStart.setFont(text);
randomStart.setForeground(Color.decode("#121212"));
- randomStart.setBorderPainted(false);
+ randomStart.setBorderPainted(true);
randomStart.setFocusPainted(false);
randomStart.setContentAreaFilled(false);
randomStart.setBounds(50, 280, 150, 50);
randomStart.setVisible(true);
randomStart.addMouseListener(hover);
+ randomStart.setBorder(new RoundedBorder(25));
+ randomStart.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ control.buildGameWindow(xAxisSize, yAxisSize, cellCount);
+ }
+ });
manuelStart = new JButton();
manuelStart.setText("Manuel Start");
manuelStart.setFont(text);
manuelStart.setForeground(Color.decode("#121212"));
- manuelStart.setBorderPainted(false);
+ manuelStart.setBorderPainted(true);
manuelStart.setFocusPainted(false);
manuelStart.setContentAreaFilled(false);
manuelStart.setBounds(225, 280, 150, 50);
manuelStart.setVisible(true);
manuelStart.addMouseListener(hover);
+ manuelStart.setBorder(new RoundedBorder(25));
+ manuelStart.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ }
+ });
- manuelStart.setBounds(225, 280, 150, 50);
-
- Icon gif = new ImageIcon("src/data/control2.png");
- JLabel gifLabel = new JLabel(gif);
- gifLabel.setBounds(391, 25, 336, 336);
- jf.getContentPane().add(gifLabel);
+ preview = new ImageIcon("src/data/PNG/Preview.png");
+ previewLabel = new JLabel(preview);
+ previewLabel.setBounds(450, 45, 203, 302);
}
private void updateStartCells() {
-
startCells.setMaximum(xAxisSize * yAxisSize);
-
}
- private void updateSliderLables(int slider, int val){
- switch (slider){
+ private void updateSliderLables(int slider, int val) {
+ switch (slider) {
case 0:
xAxisLabel.setText(String.valueOf(val));
break;
@@ -237,8 +248,7 @@ public class StartGUI{
}
}
-
- public void addComponents(){
+ private void addControlComponents() {
jf.add(heading);
jf.add(xAxis);
jf.add(xAxisName);
@@ -251,9 +261,20 @@ public class StartGUI{
jf.add(startCellsLabel);
jf.add(randomStart);
jf.add(manuelStart);
+ jf.add(previewLabel);
}
+ public void buildGameWindow() {
+
+
+ }
+
+ private void initGameComponents() {
+ }
+
+ private void addGameComponents() {
+ }
}
diff --git a/src/gui/RoundedBorder.java b/src/gui/RoundedBorder.java
new file mode 100644
index 0000000..2d4f685
--- /dev/null
+++ b/src/gui/RoundedBorder.java
@@ -0,0 +1,29 @@
+package gui;
+
+import javax.swing.border.Border;
+import java.awt.*;
+
+public class RoundedBorder implements Border {
+
+ private int radius;
+
+
+ RoundedBorder(int radius) {
+ this.radius = radius;
+ }
+
+
+ public Insets getBorderInsets(Component c) {
+ return new Insets(this.radius+1, this.radius+1, this.radius+2, this.radius);
+ }
+
+
+ public boolean isBorderOpaque() {
+ return true;
+ }
+
+
+ public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
+ g.drawRoundRect(x, y, width-1, height-1, radius, radius);
+ }
+}
\ No newline at end of file
diff --git a/src/main/Main.java b/src/main/Main.java
index b462156..72c81d5 100644
--- a/src/main/Main.java
+++ b/src/main/Main.java
@@ -1,13 +1,12 @@
package main;
-import gui.GameGUI;
-import gui.StartGUI;
+import game.Control;
+
public class Main {
public static void main(String[] args) {
- GameGUI gameGUI = new GameGUI();
-// StartGUI startGUI = new StartGUI();
+ Control control = new Control();
}