commit 03d7049a31e16be9ac39f76bc32871bb94908700
parent 1eebaa9f51cee2b6043347997d3b5c4b5e97a405
Author: William Lindholm <william_lindholm@outlook.com>
Date: Thu, 7 Nov 2024 18:30:41 +0000
Added new startpanel as example
Diffstat:
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/TicTacToeClient/src/main/java/com/groupproject/tictactoeclient/ContentPanes/StartPanel.java b/TicTacToeClient/src/main/java/com/groupproject/tictactoeclient/ContentPanes/StartPanel.java
@@ -0,0 +1,29 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
+ */
+package com.groupproject.tictactoeclient.ContentPanes;
+
+import com.groupproject.tictactoeclient.TicTacToeClient;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+/**
+ *
+ * @author Willi
+ */
+public class StartPanel extends JPanel{
+ public StartPanel(TicTacToeClient client) {
+ JButton startButton = new JButton("Start");
+ add(startButton);
+
+ startButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ client.showPanel(new MainContentPanel(client));
+ }
+ });
+ }
+}
diff --git a/TicTacToeClient/src/main/java/com/groupproject/tictactoeclient/TicTacToeClient.java b/TicTacToeClient/src/main/java/com/groupproject/tictactoeclient/TicTacToeClient.java
@@ -6,6 +6,7 @@
package com.groupproject.tictactoeclient;
import com.formdev.flatlaf.FlatDarkLaf;
import com.groupproject.tictactoeclient.ContentPanes.MainContentPanel;
+import com.groupproject.tictactoeclient.ContentPanes.StartPanel;
import com.tttws.TicTacToeWS;
import com.tttws.TicTacToeWebService;
import javax.swing.JFrame;
@@ -48,7 +49,7 @@ public class TicTacToeClient {
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(600, 400);
- showPanel(new MainContentPanel(this));
+ showPanel(new StartPanel(this));
frame.setVisible(true);
}