diff --git a/src/game/GameWindow.java b/src/game/GameWindow.java new file mode 100644 index 0000000000000000000000000000000000000000..08c8ea40f0d68898b7e352bc08fc62971aa4794b --- /dev/null +++ b/src/game/GameWindow.java @@ -0,0 +1,24 @@ +package game; + +import javax.swing.*; +import java.awt.*; + +public class GameWindow extends JFrame { + + private GameModel model; + private JTable table; + + public GameWindow(GameModel model){ + super("Game of Life"); + this.model = model; + table = new JTable(model); + + setLayout(new BorderLayout()); + add(table, BorderLayout.CENTER); + + setSize(300, 300); + setLocationRelativeTo(null); + + setVisible(true); + } +} diff --git a/src/game/StartModel.java b/src/game/StartModel.java index b2fa3f4966a719978468863590f031c6ff26ed80..3ff8fbb8cf716e63c71a22a0448f411183b46dc9 100644 --- a/src/game/StartModel.java +++ b/src/game/StartModel.java @@ -31,7 +31,7 @@ public class StartModel { File selected = fileChooser.getSelectedFile(); try { board = GameBoardJson.loadFromFile(selected); - startFrame.setTextFieldMessage(selected.getName() + "loaded."); + startFrame.setTextFieldMessage(selected.getName() + " loaded."); } catch (FileNotFoundException e) { board = null; //TODO Kell-e? e.printStackTrace(); @@ -49,6 +49,8 @@ public class StartModel { board = new GameBoard(10,10); //TODO méret } + GameModel model = new GameModel(board); //TODO clone + GameWindow game = new GameWindow(model); //TODO GameWindow } } diff --git a/src/game/StartWindow.java b/src/game/StartWindow.java index cb49d80412a35cf401d08c7b4fb534ac738ac8d7..9e5db470a965ea79d1ff43964b4ee7a1aa3d688b 100644 --- a/src/game/StartWindow.java +++ b/src/game/StartWindow.java @@ -13,12 +13,15 @@ public class StartWindow extends JFrame { this.model = model; model.setStartFrame(this); setLayout(new BorderLayout()); - setSize(300,200); + setSize(300,150); + setResizable(false); + setLocationRelativeTo(null); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); loadFileTextField = new JTextField("No file loaded."); loadFileTextField.setEditable(false); + loadFileTextField.setHorizontalAlignment(SwingConstants.CENTER); add(loadFileTextField); ActionListener listener = new StartMenuButtonsListener(model); @@ -35,6 +38,8 @@ public class StartWindow extends JFrame { add(loadDeletePanel, BorderLayout.LINE_END); JButton startButton = new JButton("Start"); + startButton.setActionCommand("start"); + startButton.addActionListener(listener); add(startButton, BorderLayout.PAGE_END); @@ -44,3 +49,4 @@ public class StartWindow extends JFrame { loadFileTextField.setText(message); } } +