diff --git a/src/main/java/src/MainFrame.java b/src/main/java/src/MainFrame.java index 3f5f6ad..332c4f5 100644 --- a/src/main/java/src/MainFrame.java +++ b/src/main/java/src/MainFrame.java @@ -1,5 +1,7 @@ package src; +import org.junit.Test; + import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; @@ -23,13 +25,25 @@ public class MainFrame extends JFrame { rootPanel.setBounds(0, 0, 500, 500); rootPanel.setBackground(Color.LIGHT_GRAY); rootPanel.setLayout(null); + this.setContentPane(rootPanel); + + JPanel header = setupHeader(20, 10); + header.setBounds(125, 5, 250, 50); + rootPanel.add(header); + +// JLabel h = new JLabel("", SwingConstants.CENTER); +// h.setText("Sudoku"); +// h.setVisible(true); +// h.setBounds(250, 25, 200, 150); +// h.setBackground(Color.GREEN); +// h.setForeground(Color.BLACK); +// h.setFont(new Font("Times new Roman", Font.BOLD, 10)); +// rootPanel.add(h); GameField gameField = new GameField(360); gameField.setBounds(70, 50, 360, 360); rootPanel.add(gameField); - this.setContentPane(rootPanel); - JPanel numberPanel = new JPanel(); numberPanel.setVisible(true); numberPanel.setBounds(100, 450, 300, 30); @@ -89,47 +103,33 @@ public class MainFrame extends JFrame { rootPanel.add(correctButton); } - private JMenuBar setupMenuBar() { + private JPanel setupHeader(int headerSize, int subheaderSize) { + + JPanel jPanel = new JPanel(); + jPanel.setVisible(true); + jPanel.setBackground(new Color(0, 0, 0, 0)); + jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS)); + + JLabel header = new JLabel(); + header.setAlignmentX(Component.CENTER_ALIGNMENT); + header.setText("Sudoku"); + header.setVisible(true); + header.setForeground(Color.BLACK); + header.setFont(new Font("Times New Roman", Font.BOLD, headerSize)); + jPanel.add(header); + + JLabel subheader = new JLabel(); + subheader.setAlignmentX(Component.CENTER_ALIGNMENT); + subheader.setText("Represented by Team Deep Thought"); + subheader.setVisible(true); + subheader.setForeground(Color.BLACK); + subheader.setFont(new Font("Times New Roman", Font.ITALIC, subheaderSize)); + jPanel.add(subheader); + + return jPanel; + } -// JMenuBar jMenuBar = new JMenuBar(); -// -// JMenu sudoku = new JMenu("Sudoku"); -// -// JMenuItem newGame = new JMenuItem("Neues Spiel"); -// -// JMenuItem easy = new JMenuItem("Einfaches Spiel"); -// JMenuItem medium = new JMenuItem("Mittleres Spiel"); -// JMenuItem hard = new JMenuItem("Hartes Spiel"); -// -// -// JMenu help = new JMenu("Help"); -// -// JMenuItem howTo = new JMenuItem("how-to"); -// -// -// newGame.add(easy); -// newGame.add(medium); -// newGame.add(hard); -// -// howTo.addActionListener(new ActionListener() { -// @Override -// public void actionPerformed(ActionEvent e) { -// HelpFrame helpFrame = new HelpFrame(); -// helpFrame.run(); -// } -// }); -// -// -// newGame.add(easy); -// newGame.add(medium); -// newGame.add(hard); -// -// sudoku.add(newGame); -// -// help.add(howTo); -// -// jMenuBar.add(sudoku); -// jMenuBar.add(help); + private JMenuBar setupMenuBar() { JMenuBar menu_mb=new JMenuBar(); diff --git a/src/test/java/src/MainFrameTest.java b/src/test/java/src/MainFrameTest.java new file mode 100644 index 0000000..91aa24a --- /dev/null +++ b/src/test/java/src/MainFrameTest.java @@ -0,0 +1,10 @@ +package src; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class MainFrameTest { + + +} \ No newline at end of file