From 43abd90de10313a4231e67043fd5fb4357a2cea2 Mon Sep 17 00:00:00 2001 From: Steffen Helmke Date: Mon, 10 Jan 2022 11:52:39 +0100 Subject: [PATCH] 4gewinnt: added gui-layout and testing methods --- .../java/de/tims/viergewinnt/ai/Logic.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/main/java/de/tims/viergewinnt/ai/Logic.java b/src/main/java/de/tims/viergewinnt/ai/Logic.java index 7dc55bc..c4fc3d5 100644 --- a/src/main/java/de/tims/viergewinnt/ai/Logic.java +++ b/src/main/java/de/tims/viergewinnt/ai/Logic.java @@ -1,6 +1,42 @@ package de.tims.viergewinnt.ai; +import javax.swing.JFrame; +import javax.swing.JPanel; + public class Logic { + + //only for testing, remove when finished + static JFrame content; + + static JPanel contentPanel; + static JPanel buttonPanel; + static JPanel playfieldPanel; + + public static JPanel create4gewinntGui() { + + //only for testing, remove when finished + content = new JFrame(); + content.setSize(200,200); + + contentPanel = new JPanel(); + + //only for testing, remove when finished + content.add(contentPanel); + + buttonPanel = new JPanel(); + playfieldPanel = new JPanel(); + contentPanel.add(buttonPanel); + contentPanel.add(playfieldPanel); + + return contentPanel; + } + + //only for testing, remove when finished + public static void main(String[] args) { + create4gewinntGui(); + content.setVisible(true); + } + public boolean testForWin(int[][] playfield, int player) { int chain = 0; for(int i = 0; i < playfield[0].length; i++) {