The JavaFX Checker Game is a grid-based game application built using JavaFX. It features an interactive board where users can add and remove graphical objects (such as circles) by clicking on the grid. The project demonstrates object-oriented programming principles and JavaFX capabilities for creating graphical user interfaces (GUIs).
- Interactive grid board with alternating colors.
- Ability to click on a grid square to add a graphical object.
- User interface with:
- Input fields for specifying row and column numbers.
- A button to remove elements from the grid.
- Customizable board size and square properties.
This project consists of several Java classes:
- The main class that initializes and launches the JavaFX application.
- Handles user interactions and updates the graphical interface.
- Manages the grid layout and interactions.
- Draws the board and calculates positions of grid squares.
- Represents individual squares on the board.
- Handles graphical rendering of rectangles.
- Represents circular graphical elements.
- Encapsulates attributes such as radius, fill color, and border color.
- Represents custom graphical objects that can be added to the board.
- Uses the
Circle
class for rendering.
- Java 11 or higher.
- JavaFX SDK (download from OpenJFX).
- IntelliJ IDEA or any other Java IDE.
-
Clone the Repository:
git clone https://github.com/justtcallmejayy/JavaFX-Checker-Game.git cd JavaFX-Checker-Game
-
Open in IntelliJ IDEA:
- Open the cloned folder as a project in IntelliJ IDEA.
-
Add JavaFX SDK:
- Go to File > Project Structure > Libraries.
- Add the
lib
folder from your JavaFX SDK directory.
-
Configure VM Options:
- Go to Run > Edit Configurations.
- Add the following VM options:
--module-path <path-to-javafx-sdk>/lib --add-modules javafx.controls,javafx.fxml
-
Run the Application:
- Build and run the
GameApp
class.
- Build and run the
- Click on the grid to add a
Green
object (circle) to a square. - Use the input fields to specify a square's row and column.
- Click the "Remove" button to remove objects from the grid.
JavaFX-Checker-Game/
├── src/
│ ├── GameApp.java
│ ├── Board.java
│ ├── Rectangle.java
│ ├── Circle.java
│ └── Green.java
├── .gitignore
├── README.md
└── package.bluej
Feel free to fork this repository and submit pull requests for enhancements or bug fixes.
- Built using JavaFX.
- Special thanks to OpenJFX for providing JavaFX resources.
Enjoy the game and happy coding!