From cd0ddb7a486a660527513dfc78a893c3eccf2553 Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Mon, 27 Dec 2021 16:27:37 +0100 Subject: [PATCH] gameexplorer: added navigation panel + refactoring --- .../de/tims/gameexplorer/GameExplorer.java | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/tims/gameexplorer/GameExplorer.java b/src/main/java/de/tims/gameexplorer/GameExplorer.java index e77b246..f174d1f 100644 --- a/src/main/java/de/tims/gameexplorer/GameExplorer.java +++ b/src/main/java/de/tims/gameexplorer/GameExplorer.java @@ -7,6 +7,7 @@ public class GameExplorer { private JFrame frame; private JPanel explorerPanel; + private JPanel navigationPanel; private JPanel border1; private JPanel border2; private JPanel border3; @@ -16,6 +17,8 @@ public class GameExplorer { private JButton fourwinsBtn; private JButton tictactoeBtn; private JButton leaderboardBtn; + private JButton backBtn; + private JLabel chosenGame; private Dimension minSize; private Dimension btnSize; private GridBagConstraints gbc; @@ -27,6 +30,19 @@ public class GameExplorer { btnSize = new Dimension(160, 40); gbc = new GridBagConstraints(); + buildExplorerPanel(); + buildNavigationPanel(); + + frame.add(explorerPanel); + + frame.setMinimumSize(minSize); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setSize(640, 480); + frame.setResizable(true); + frame.setVisible(true); + } + + private void buildExplorerPanel() { explorerPanel = new JPanel(); explorerPanel.setLayout(new GridBagLayout()); @@ -94,14 +110,17 @@ public class GameExplorer { gbc.gridy = 8; gbc.weighty = 0.2; explorerPanel.add(border5, gbc); + } + + private void buildNavigationPanel() { + navigationPanel = new JPanel(); - frame.add(explorerPanel); + backBtn = new JButton("< Zurück"); - frame.setMinimumSize(minSize); - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - frame.setSize(640, 480); - frame.setResizable(true); - frame.setVisible(true); + chosenGame = new JLabel(); + + navigationPanel.add(backBtn); + navigationPanel.add(chosenGame); } public static void main(String[] args) {