0% found this document useful (0 votes)
168 views19 pages

Ajp Microproject Report

This document is a project report for developing a Tic Tac Toe game using Swing components in Java. It includes an introduction describing the game and objectives of creating the project. It outlines the course outcomes integrated, literature review conducted, and proposed methodology of 6 steps to develop the game. It also lists the actual resources used including the Java Development Kit, Microsoft Word, and Notepad. The output provided is the Java code for the game logic and user interface using Swing buttons and text fields to display the board and detect wins or draws.

Uploaded by

Jay Ram Jadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
168 views19 pages

Ajp Microproject Report

This document is a project report for developing a Tic Tac Toe game using Swing components in Java. It includes an introduction describing the game and objectives of creating the project. It outlines the course outcomes integrated, literature review conducted, and proposed methodology of 6 steps to develop the game. It also lists the actual resources used including the Java Development Kit, Microsoft Word, and Notepad. The output provided is the Java code for the game logic and user interface using Swing buttons and text fields to display the board and detect wins or draws.

Uploaded by

Jay Ram Jadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

lOMoARcPSD|19237721

AJP Microproject Report

Computer engineering (Government Polytechnic, Ratnagiri)

Studocu is not sponsored or endorsed by any college or university


Downloaded by Gajanand Tope ([email protected])
lOMoARcPSD|19237721

GOVERNMENT POLYTECHNIC, RATNAGIRI

A Project Report On

"TIC TAC TOE GAME USING SWING COMPONENT "

Submitted to

COMPUTER ENGINEERIG DEPARTMENT

Under the guidance of

Rashmi More

Submitted by

Ruhin Khalil Modak – (1900130119)

Rashmi Milind Joshi – (1900130209)

Alamaara Sarfarajnawaj Kazi – (1900130208)

Through

GOVERNMENT POLYTECHNIC, RATNAGIRI

2021 – 2022

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

MAHARASHTRA STATE
BOARD OF TECHNICAL EDUCATION

Certificate
This is certified that of Fifth Semester of Diploma in T.Y.CO5I of Institute Government Polytechnic,
Ratnagiri (Code – 0013 ) has completed the team work satisfactorily in subject Advance Java
programing. for the academic year 2021 – 2022 as prescribed in the curriculum.

List of team members :


RUHIN KHALIL MODAK 1900130119

ALMAARA SARFRAJ V KAZI 190013208

RASHMU MILIND JOSHI 1900130209

Place : Ratnagiri Date


:

Subject Teacher Head Of Department Principal

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

PART B –
Format For Micro Project Report
For 5th & 6th Semester

TIC TAC TOE GAME USING SWING COMPONENT

1.0 Rationale:
Tic-Tac-Toe is traditionally Played on a 3x3 grid. The goal of the game is for players to position their
marks so that they make a continuous line of three cells vertically, horizontally, or diagonally. In this
game, two players will be Play and you have one print board on the screen where from 1 to 9 numbers
will be displayed. This interesting Java Project will be build using swings libraries. Swing is a popular
java library that is used to develop beautiful GUI applications. This game combines components of fitness
such as a speed, agility, cardiovascular fitness and Problem Solving skills..

2.0 Course Outcome Integrated:


1. Develop program using swing component
2. Handle events of swing components
3.0 Literature Review
1. https://www.softwaretestinghelp.com
To Study the Swing Components in Java
2. https://www.thepruecraf.com/tic-tac-toe- game.-rules-412170.t To Study
the Rules of The Tic-Tac-Toe Game

4.0 Proposed Methodology :


Step 1: First we have find the project over the Internet.

Step 2: Selected the appropriate topic as < TIC TAC TOE GAME USING SWING COMPONENT= by
discussing with our group members.
Step 3: Gained information about the overall concept of the project and discussed with group members
about how to develop the project ad which team member will do what work.
Step 4 : Ten we starting to create Admission from and insert data in database using reference book of java
Step 5 : Coding was done by the team member as per the task assigned to each team member.

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

Step 6 : Last but not least, each and every team member contributed to create the project documentation.

5.0 ACTUAL RESOURCES USED:

Sr. Name of Resource / Specification Qty Remarks


No. material

1 JDK Version-17 - 1

2 MS Word RAM-8GB 1
Computer(i5)
Windows 11
-

3 Notepad 10.2103.6.0 1

6.0 Output Of The Micro Project

* Code :
Subject.

import java.awt.event.*;
import javax.swing.*; class
Tgame extends JFrame
{ int
k=0,l=0,count=0;
JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b;
JTextField tf; public Tgame(String
s){ super(s); } public void
setComponent() { tf=new
JTextField();
tf.setBounds(20,370,250,30);
tf.setEditable(false); b=new
JButton("Start New Game");
b.setBounds(90,320,130,30);

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

b1=new JButton("");
b1.setBounds(13,13,90,90); b2=new
JButton("");
b2.setBounds(110,13,90,90);
b3=new JButton("");
b3.setBounds(207,13,90,90);
b4=new JButton("");
b4.setBounds(13,110,90,90);
b5=new JButton("");
b5.setBounds(110,110,90,90);
b6=new JButton("");
b6.setBounds(207,110,90,90);
b7=new JButton("");
b7.setBounds(13,207,90,90);
b8=new JButton("");
b8.setBounds(110,207,90,90);
b9=new JButton("");
b9.setBounds(207,207,90,90);
b1.addActionListener(new A1())
b2.addActionListener(new A2());
b3.addActionListener(new A3());
b4.addActionListener(new A4());
b5.addActionListener(new A5());
b6.addActionListener(new A6());
b7.addActionListener(new A7());
b8.addActionListener(new A8());
b9.addActionListener(new A9());
b.addActionListener(new A());

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

add(b1); add(b2); add(b3); add(b4);


add(b5); add(b6); add(b7); add(b8);
add(b9); add(b); add(tf); }
public void setEnable()
{
b1.setEnabled(false); b2.setEnabled(false);
b3.setEnabled(false); b4.setEnabled(false);
b5.setEnabled(false); b6.setEnabled(false);
b7.setEnabled(false); b8.setEnabled(false);
b9.setEnabled(false); } public int check()
{ count++;
if(b1.getText()=="X"&&b2.getText()=="X"&&b3.getText()=="X") return
1;
else if(b1.getText()=="X"&&b4.getText()=="X"&&b7.getText()=="X")
return 1;
else if(b1.getText()=="X"&&b5.getText()=="X"&&b9.getText()=="X")
return 1;
else if(b2.getText()=="X"&&b5.getText()=="X"&&b8.getText()=="X")
return 1;
else if(b3.getText()=="X"&&b6.getText()=="X"&&b9.getText()=="X")
return 1;

else if(b3.getText()=="X"&&b5.getText()=="X"&&b7.getText()=="X")
return 1;
else if(b4.getText()=="X"&&b5.getText()=="X"&&b6.getText()=="X")
return 1;
else if(b7.getText()=="X"&&b8.getText()=="X"&&b9.getText()=="X")
return 1;

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

else if(b1.getText()=="0"&&b2.getText()=="0"&&b3.getText()=="0")
return 2;
else if(b1.getText()=="0"&&b4.getText()=="0"&&b7.getText()=="0")
return 2;

else if(b1.getText()=="0"&&b5.getText()=="0"&&b9.getText()=="0")
return 2;
else if(b2.getText()=="0"&&b5.getText()=="0"&&b8.getText()=="0")
return 2;

else if(b3.getText()=="0"&&b6.getText()=="0"&&b9.getText()=="0")
return 2;
else if(b3.getText()=="0"&&b5.getText()=="0"&&b7.getText()=="0")
return 2;
else if(b4.getText()=="0"&&b5.getText()=="0"&&b6.getText()=="0")
return 2;
else if(b7.getText()=="0"&&b8.getText()=="0"&&b9.getText()=="0")
return 2; else{ if(count==9) tf.setText("Game Draw"); return 3;
}}
class A implements ActionListener
{
public void actionPerformed(ActionEvent ae)
{ k=0;l=0;count=0;
b1.setText(""); b2.setText("");
b3.setText(""); b4.setText("");
b5.setText(""); b6.setText("");
b7.setText(""); b8.setText("");
b9.setText("");
b1.setEnabled(true);
b2.setEnabled(true);

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

b3.setEnabled(true);
b4.setEnabled(true);
b5.setEnabled(true);
b6.setEnabled(true);
b7.setEnabled(true);
b8.setEnabled(true);
b9.setEnabled(true);
tf.setText("");
}}
class A1 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{ if(k==0){
b1.setText("X"); k=1;
b1.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; } else{
b1.setText("0"); k=0;
b1.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable();

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

} else;
}
}}
class A2 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{ if(k==0){
b2.setText("X"); k=1;
b2.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; } else{
b2.setText("0"); k=0;
b2.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else

if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; }
}}
class A3 implements ActionListener
{
public void actionPerformed(ActionEvent e)

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

{ if(k==0){
b3.setText("X"); k=1;
b3.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; } else{
b3.setText("0"); k=0;
b3.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; }
}}
class A4 implements ActionListener
{
public void actionPerformed(ActionEvent e) { if(k==0){ b4.setText("X"); k=1; b4.setEnabled(false);
l=check(); if(l==1){ tf.setText("Player 1 Won"); setEnable(); } else if(l==2){ tf.setText("Player 2 Won");
setEnable(); } else; } else{ b4.setText("0"); k=0; b4.setEnabled(false); l=check(); if(l==1){
tf.setText("Player 1 Won"); setEnable(); } else if(l==2){ tf.setText("Player 2 Won"); setEnable(); } else; }
}}
class A5 implements ActionListener
{
public void actionPerformed(ActionEvent e)

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

{ if(k==0){
b5.setText("X"); k=1;
b5.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1
Won"); setEnable();
} else if(l==2){
tf.setText("Player 2
Won"); setEnable();
} else; } else{
b5.setText("0"); k=0;
b5.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1
Won"); setEnable(); }
else if(l==2){
tf.setText("Player 2
Won"); setEnable();
} else; }
} } class A6 implements
ActionListener
{
public void actionPerformed(ActionEvent e)
{ if(k==0){
b6.setText("X"); k=1;
b6.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; } else{
b6.setText("0"); k=0;
b6.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable();
} else;
}
}}
class A7 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{ if(k==0){
b7.setText("X"); k=1;
b7.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; } else{
b7.setText("0"); k=0;
b7.setEnabled(false);

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; }
}}
class A8 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{ if(k==0){
b8.setText("X"); k=1;
b8.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; } else{
b8.setText("0"); k=0;
b8.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else
if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; }
}}

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

class A9 implements ActionListener


{
public void actionPerformed(ActionEvent e)
{ if(k==0){ b9.setText("X");
k=1; b9.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable(); } else

if(l==2){ tf.setText("Player
2 Won"); setEnable(); }
else; } else{
b9.setText("0"); k=0;
b9.setEnabled(false);
l=check(); if(l==1){
tf.setText("Player 1 Won");
setEnable();

} else if(l==2){
tf.setText("Player 2 Won");
setEnable(); } else; }
}}
public static void main(String []args)
{
Tgame jf=new Tgame("Tic Tac Toe");
jf.setComponent(); jf.setSize(325,450);
jf.setLocation(100,100);
jf.setLayout(null);

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

jf.setVisible(true); jf.setResizable(false);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

7. Skills Developed/learning out of this Micro-Project

1. In this project we have learned about Swing Components and their use.
2. it helps children to improve their concentration.
3. These tic-tac-toe panels improve hand-eye coordination and encourage
better social interaction by better collaborative play.

8. Applications of this Micro-Project

1. it is also a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3
grid.

Downloaded by Gajanand Tope ([email protected])


lOMoARcPSD|19237721

2. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins
the game.

Downloaded by Gajanand Tope ([email protected])

You might also like