diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..07b86b3
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/bishop_black.png b/res/bishop_black.png
new file mode 100644
index 0000000..453cb32
Binary files /dev/null and b/res/bishop_black.png differ
diff --git a/res/bishop_white.png b/res/bishop_white.png
new file mode 100644
index 0000000..26dae01
Binary files /dev/null and b/res/bishop_white.png differ
diff --git a/res/king_black.png b/res/king_black.png
new file mode 100644
index 0000000..225f869
Binary files /dev/null and b/res/king_black.png differ
diff --git a/res/king_white.png b/res/king_white.png
new file mode 100644
index 0000000..d734164
Binary files /dev/null and b/res/king_white.png differ
diff --git a/res/knight_black.png b/res/knight_black.png
new file mode 100644
index 0000000..8e3d04e
Binary files /dev/null and b/res/knight_black.png differ
diff --git a/res/knight_white.png b/res/knight_white.png
new file mode 100644
index 0000000..2d716b1
Binary files /dev/null and b/res/knight_white.png differ
diff --git a/res/pawn_black.png b/res/pawn_black.png
new file mode 100644
index 0000000..c432d38
Binary files /dev/null and b/res/pawn_black.png differ
diff --git a/res/pawn_white.png b/res/pawn_white.png
new file mode 100644
index 0000000..e98fae2
Binary files /dev/null and b/res/pawn_white.png differ
diff --git a/res/queen_black.png b/res/queen_black.png
new file mode 100644
index 0000000..0d94a1c
Binary files /dev/null and b/res/queen_black.png differ
diff --git a/res/queen_white.png b/res/queen_white.png
new file mode 100644
index 0000000..a4fe68c
Binary files /dev/null and b/res/queen_white.png differ
diff --git a/res/rook_black.png b/res/rook_black.png
new file mode 100644
index 0000000..b9748e8
Binary files /dev/null and b/res/rook_black.png differ
diff --git a/res/rook_white.png b/res/rook_white.png
new file mode 100644
index 0000000..a805de4
Binary files /dev/null and b/res/rook_white.png differ
diff --git a/src/dev/kske/chess/BoardPanel.java b/src/dev/kske/chess/BoardPanel.java
new file mode 100644
index 0000000..3cc007e
--- /dev/null
+++ b/src/dev/kske/chess/BoardPanel.java
@@ -0,0 +1,67 @@
+package dev.kske.chess;
+
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+
+import javax.swing.JPanel;
+
+/**
+ * Project: Chess
+ * File: BoardPanel.java
+ * Created: 01.07.2019
+ * Author: Kai S. K. Engelbart
+ *
+ * A square panel for rendering the chess board. To work correctly,
+ * this must be added to a parent component that allows the child to decide the
+ * size.
+ */
+public class BoardPanel extends JPanel {
+
+ private static final long serialVersionUID = 6771148331334310216L;
+
+ private int tileSize;
+
+ public BoardPanel() {
+ // Add a component listener for adjusting the tile size on resizing
+ addComponentListener(new ComponentAdapter() {
+
+ @Override
+ public void componentResized(ComponentEvent e) {
+ tileSize = getWidth() / 8;
+ }
+ });
+ }
+
+ @Override
+ protected void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ g.setColor(Color.white);
+ for (int i = 0; i < 8; i++)
+ for (int j = 0; j < 8; j++) {
+ if (j > 0) g.setColor(g.getColor().equals(Color.white) ? Color.black : Color.white);
+ g.fillRect(tileSize * i, tileSize * j, tileSize, tileSize);
+ }
+ }
+
+ @Override
+ public Dimension getMinimumSize() { return getPreferredSize(); }
+
+ @Override
+ public Dimension getMaximumSize() { return getPreferredSize(); }
+
+ @Override
+ public Dimension getPreferredSize() {
+ Dimension d = super.getPreferredSize();
+ Container c = getParent();
+ if (c != null) d = c.getSize();
+ else return new Dimension(480, 480);
+ int w = (int) d.getWidth();
+ int h = (int) d.getHeight();
+ int s = Math.max(w, h);
+ return new Dimension(s, s);
+ }
+}
diff --git a/src/dev/kske/chess/Chess.java b/src/dev/kske/chess/Chess.java
new file mode 100644
index 0000000..053c1dd
--- /dev/null
+++ b/src/dev/kske/chess/Chess.java
@@ -0,0 +1,56 @@
+package dev.kske.chess;
+
+import java.awt.BorderLayout;
+import java.awt.EventQueue;
+
+import javax.swing.JFrame;
+
+
+/**
+ * Project: Chess
+ * File: Chess.java
+ * Created: 01.07.2019
+ * Author: Kai S. K. Engelbart
+ */
+public class Chess {
+
+ private JFrame mframe;
+
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ EventQueue.invokeLater(new Runnable() {
+
+ public void run() {
+ try {
+ Chess window = new Chess();
+ window.mframe.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /**
+ * Create the application.
+ */
+ public Chess() {
+ initialize();
+ }
+
+ /**
+ * Initialize the contents of the frame.
+ */
+ private void initialize() {
+ mframe = new JFrame();
+ mframe.setBounds(100, 100, 740, 740);
+ mframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ BoardPanel boardPanel = new BoardPanel();
+ boardPanel.setLayout(null);
+ mframe.getContentPane().add(boardPanel, BorderLayout.CENTER);
+ }
+
+}
diff --git a/src/dev/kske/chess/TextureLoader.java b/src/dev/kske/chess/TextureLoader.java
new file mode 100644
index 0000000..f805cc6
--- /dev/null
+++ b/src/dev/kske/chess/TextureLoader.java
@@ -0,0 +1,38 @@
+package dev.kske.chess;
+
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+/**
+ * Project: Chess
+ * File: TextureLoader.java
+ * Created: 01.07.2019
+ * Author: Kai S. K. Engelbart
+ */
+public class TextureLoader {
+
+ private TextureLoader() {}
+
+ /**
+ * Loads an image from the resource folder and scales it to a square.
+ *
+ * @param name The name of the file without the PNG extension in the resource
+ * folder
+ * @param scale The side length of the square to which the image will be scaled
+ * @return The scaled image
+ */
+ public static Image loadScaledImage(String name, int scale) {
+ BufferedImage in = null;
+ try {
+ in = ImageIO.read(new File("res" + File.separator + name + ".png"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ Image scaled = in.getScaledInstance(scale, scale, Image.SCALE_SMOOTH);
+ return scaled;
+ }
+}