Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

abhishekdpandey18/CheckMate-Java

Repository files navigation

GUI-Based Java Project

πŸ“‹ Project Overview

To build a two-player GUI-based Chess game in Java, focusing on game rules, move validation, and an interactive interface. The project helps improve skills in object-oriented programming and GUI development.


πŸ“Œ Features

  • 🧠 Smart move validation and check/checkmate detection
  • 🎨 Customizable GUI using Java Swing
  • πŸ§‘β€πŸ€β€πŸ§‘ Local 2-player mode
  • β™ŸοΈ Accurate piece movement rules
  • πŸ’Ύ Save/load game (if implemented)
  • 🧰 Full Chess rule enforcement
  • β˜• Interactive GUI using Java Swing
  • πŸ’‘ Special moves: castling, en passant, promotion
  • β˜‘οΈ Check and checkmate detection

πŸ“Έ Screenshots


πŸ‘¨β€πŸ’» Contributors


βœ… 1. πŸ› οΈ Development Setup

βœ… JDK Version

  • JDK Version: Java SE Development Kit 17
  • Make sure JDK 17 is installed and configured in your environment.
  • Download JDK

βœ… IDE Used

  • IDE: IntelliJ IDEA Community Edition 2023
  • You may also use Eclipse or VS Code with Java extensions.

βœ… 2. ✨ Project Structure

  • The project Structure in already given in a text file CheckMate ## Project Structure.txt

βœ… 3. πŸ—ƒοΈ Database Schema Design

The project uses a MySQL database to store chess game details and move history.


βœ… 4. πŸ“‚ MySQL Tables

  • Game
    Stores the overall game information like player names, winner, and timestamps.

  • MoveHistory
    Stores each move made in a game, including notation, origin/destination squares, and timestamps.

  • SQL Schema File

The database schema is defined in schema.sql, which includes:

CREATE TABLE Game (...);
CREATE TABLE MoveHistory (...);

βœ… 5. 🌸 JDBC Implementation

We've successfully implemented JDBC to enable interaction between our Java Chess game and a MySQL database.

  • A dedicated DatabaseConnection.java class was created to handle the database connection logic.
  • JDBC is used to connect the Java application to a MySQL database (chessdb).
  • This connection will support storing and retrieving move history or other game-related data in future extensions.

πŸ“„ DatabaseConnection.java Highlights

package com.chess.database;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DatabaseConnection {
 private static final String URL = "jdbc:mysql://localhost:3306/chessdb";
 private static final String USER = "root";
 private static final String PASSWORD = "yourpassword";
 public static Connection getConnection() throws SQLException {
 return DriverManager.getConnection(URL, USER, PASSWORD);
 }
}

βœ… 6. πŸŽ€ Create Model & DAO

To manage database interactions cleanly and efficiently, we implemented:

🧩 MoveRecord.java (Model)

  • This class represents a single record of a chess move. It includes:
  • moveNumber – The sequential number of the move.
  • whiteMove – Move made by the White player.
  • blackMove – Move made by the Black player.

βœ… 7. 🎨 Aesthetics and UI Design

  • We enhanced the user interface of the Java Chess game to improve usability and visual appeal by:
  • Using custom fonts for a cleaner and more modern look.
  • Optimizing layouts with appropriate spacing and component alignment.
  • Adding colors to differentiate player moves and highlight game states (e.g., check, checkmate).
  • Incorporating icons and images for chess pieces and game status indicators.
  • Ensuring the UI adapts well to different window sizes for better responsiveness. -These improvements help create a more engaging and intuitive gameplay experience.

βœ… 8. πŸ₯‡Component Placement

  • The game GUI components are thoughtfully arranged to ensure clarity and usability:
  • All panels and elements (chessboard, move history, taken pieces) are properly aligned using layout managers.
  • Consistent spacing and sizing maintain a balanced and clean interface.
  • Scroll panes and tables resize gracefully, keeping the move history accessible and readable.
  • No major redesign was needed since the existing layout was already well-structured and user-friendly.

βœ… 9. ⌨️ Responsiveness & Accessibility

  • To enhance user experience, we incorporated:
  • Keyboard shortcuts for common actions (e.g., undo move, restart game) to speed up gameplay.
  • Tooltips on buttons and interactive components to guide users intuitively.
  • A scalable layout that adjusts gracefully to different window sizes (optional but encouraged).
  • These improvements make the game more accessible and user-friendly for a wider audience.

βœ…10. ⌨️ Play! Enjoy Guys

  • β™ŸοΈ Why did the chess player bring a ladder to the game? Because they heard the king was in a high position! πŸ˜„
  • β™ŸοΈ Why don’t chess players ever get locked out of their houses? Because they always have a key square! πŸ˜„

About

A Java-based two-player Chess game with GUI, focusing on rules, move validation, and OOP.

Topics

Resources

Stars

Watchers

Forks

Contributors 2

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /