Skip to content

SumitSharma2000/JAVA-PROJECT-2023

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note Taking Application

JavaNote is a simple text-based note-taking application designed to help users create, organize, and manage their notes efficiently. With features like formatting, categorization, and basic search functionality, JavaNote provides a user-friendly interface for maintaining digital notes. This project is an excellent opportunity to practice Java programming and GUI development skills.

Key Features:

  • User Authentication: Users can create accounts or log in securely to access their notes.

  • Note Creation and Editing: Users can create new notes, edit existing ones, and apply basic formatting (such as bold, italic, and underline) using a user-friendly text editor.

  • Categorization: Notes can be categorized into different topics or folders, allowing users to better organize their content.

  • Search Functionality: Users can search for specific notes by keywords, titles, or tags.

  • User Interface: A graphical user interface (GUI) will be provided for users to interact with the application. The GUI should include buttons, menus, and text areas for creating, editing, and managing notes.

  • File Persistence: Notes and user data will be saved locally using file storage. Serialization can be used to save and load notes.

  • Formatting Options: Implement a set of buttons or formatting shortcuts that users can use to apply formatting options to selected text in the note editor.

  • Responsive Design: Design the application’s GUI to be responsive and user-friendly, ensuring that it works well on different screen sizes.

  • Data Validation: Implement input validation to ensure that users enter valid data when creating or editing notes.

Screenshots

Screenshot 2024-07-20 100414 Screenshot 2024-07-20 100431 Screenshot 2024-07-20 100439


TicTacToe Game

Overview

Welcome to the TicTacToe game! This is a simple yet engaging graphical version of the classic TicTacToe game implemented in Java using Swing. The game allows you to play against the computer, with adjustable settings for line thickness and player colors.

Features

  • Interactive Gameplay: Click on the grid to make your move.
  • Adjustable Line Thickness: Use the slider to adjust the thickness of the grid lines.
  • Customizable Colors: Choose different colors for 'O' and 'X' using the color picker.
  • Game Statistics: Keep track of your wins, losses, and draws.
  • Computer Opponent: Play against an AI that tries to block your moves and win the game.

Getting Started

Prerequisites

  • Java Development Kit (JDK) installed on your computer.

Running the Game

  1. Save the code to a file named TicTacToe.java.
  2. Open a terminal or command prompt.
  3. Navigate to the directory where TicTacToe.java is saved.
  4. Compile the Java file using the command:

Copy code - javac TicTacToe.java

  1. Run the compiled Java program using the command:

Copy code - java TicTacToe

How to Play

  • Start the Game: Launch the game to see the TicTacToe grid.
  • Make a Move: Click on an empty cell to place your 'O'.
  • Computer's Turn: After you place 'O', the computer will automatically make its move as 'X'.
  • Win, Lose, or Draw: The game checks for a win, loss, or draw after each move. If the game ends, a dialog box will show the result and ask if you want to play again.
  • Adjust Settings:
    • Use the Line Thickness slider to change the thickness of the grid lines.
    • Click on the O Color button to choose a new color for 'O'.
    • Click on the X Color button to choose a new color for 'X'.

Code Explanation

Main Class: TicTacToe

  • TicTacToe(): The constructor initializes the game window, adding the slider, color buttons, and the game board.
  • stateChanged(ChangeEvent e): Adjusts the line thickness based on the slider's value.
  • actionPerformed(ActionEvent e): Opens a color chooser dialog to change the color of 'O' or 'X'.

Inner Class: Board

  • Board(): Adds a mouse listener to handle user clicks on the game board.
  • paintComponent(Graphics g): Draws the TicTacToe grid and the 'O' and 'X' marks.
  • mouseClicked(MouseEvent e): Handles user clicks to place 'O' and triggers the computer's move.
  • putX(): Manages the computer's moves and checks for game over conditions.
  • won(char player): Checks if the specified player has won the game.
  • testRow(char player, int a, int b): Tests if a player has completed a row.
  • nextMove(): Determines the best move for the computer.
  • findRow(char player): Finds a row where the specified player can win or block.
  • find1Row(char player, int a, int b): Finds a blank spot in a row where the player can win or block.
  • isDraw(): Checks if the game is a draw.
  • newGame(char winner): Resets the board and starts a new game, showing the result of the previous game.

Customization

You can easily customize the game by modifying the following parts of the code:

  • Initial Line Thickness: Change the initial value of lineThickness in the TicTacToe constructor.
  • Initial Colors: Change the initial values of oColor and xColor in the TicTacToe constructor.
  • Board Size: Adjust the size of the game window by changing the dimensions in the setSize() method call.

Conclusion

Enjoy playing this graphical TicTacToe game against the computer. Customize the game settings to your liking and see how many times you can win against the AI!

ScreenShots

Screenshot (274) Screenshot (275) Screenshot (276) Screenshot (277) Screenshot (278) Screenshot (279) Screenshot (280) Screenshot (281)

About

TicTacToaa Game , World Map

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages