From 25f30237d28014dbfb8da9b09aecedb72b9120e7 Mon Sep 17 00:00:00 2001 From: Alexander Hartung Date: Fri, 21 Jan 2022 14:18:17 +0100 Subject: [PATCH] init GameWindow --- .gitignore | 22 +++++++++++++++ src/main/java/hauptmenue/GameWindow.java | 27 ++++++++++++++++++ src/main/java/hauptmenue/main.java | 10 +++++++ src/main/java/solitaer/SolitaerGamePanel.java | 28 +++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 src/main/java/hauptmenue/GameWindow.java create mode 100644 src/main/java/hauptmenue/main.java create mode 100644 src/main/java/solitaer/SolitaerGamePanel.java diff --git a/.gitignore b/.gitignore index 84adb3f..c837958 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,25 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +### Maven ### +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +# Eclipse m2e generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# End of https://www.toptal.com/developers/gitignore/api/maven + diff --git a/src/main/java/hauptmenue/GameWindow.java b/src/main/java/hauptmenue/GameWindow.java new file mode 100644 index 0000000..a2c7479 --- /dev/null +++ b/src/main/java/hauptmenue/GameWindow.java @@ -0,0 +1,27 @@ +package hauptmenue; + +import java.awt.Dimension; + +import javax.swing.JFrame; + +import solitaer.SolitaerGamePanel; + +public class GameWindow extends JFrame { + + /** + * + */ + private static final long serialVersionUID = 1L; + private final SolitaerGamePanel gamePanel = new SolitaerGamePanel(); + + public GameWindow() { + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + gamePanel.setPreferredSize(new Dimension(1180, 780)); + + add(gamePanel); + pack(); + + setVisible(true); + } + +} diff --git a/src/main/java/hauptmenue/main.java b/src/main/java/hauptmenue/main.java new file mode 100644 index 0000000..3f53c7f --- /dev/null +++ b/src/main/java/hauptmenue/main.java @@ -0,0 +1,10 @@ +package hauptmenue; + +public class main { + + public static void main(String[] args) { + // TODO Auto-generated method stub + new GameWindow(); + } + +} diff --git a/src/main/java/solitaer/SolitaerGamePanel.java b/src/main/java/solitaer/SolitaerGamePanel.java new file mode 100644 index 0000000..3fa1888 --- /dev/null +++ b/src/main/java/solitaer/SolitaerGamePanel.java @@ -0,0 +1,28 @@ +package solitaer; + +import java.awt.Color; +import java.awt.Graphics; + +import javax.swing.JPanel; + +public class SolitaerGamePanel extends JPanel { + + /** + * + */ + private static final long serialVersionUID = 1L; + + + public SolitaerGamePanel() { + setLayout(null); + } + + + @Override + protected void paintComponent(Graphics g) { + // TODO Auto-generated method stub + super.paintComponent(g); + g.setColor(Color.green); + g.fillRect(0, 0, this.getWidth(), this.getHeight()); + } +}