Playback starts YouTube’s embedded player (privacy-enhanced mode).
How to Create a Tic Tac Toe Game in Java NetBeans
ChannelDJ OamenDescription from the creator
Create a TicTacToe games in Java NetBeans using Methods, call to methods, if statement, JFrame, jButtons, jPanels, jLabels and setting panels properties.
To support more videos from DJ Oamen, visit POamen Paypal
paypal.me/POamen
To Become a Channel member click on the Link below to JOIN:
youtube.com/channel/UCFtw9CfTfMKU9aHZsT2teYg/jo…
Winning Solution for Player O below:
if (b1==("O") && b2 == ("O") && b3 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton1.setBackground(Color.PINK);
jButton2.setBackground(Color.PINK);
jButton3.setBackground(Color.PINK);
}
if (b4==("O") && b5 == ("O") && b6 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton4.setBackground(Color.YELLOW);
jButton5.setBackground(Color.YELLOW);
jButton6.setBackground(Color.YELLOW);
}
if (b7==("O") && b8 == ("O") && b9 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton7.setBackground(Color.MAGENTA);
jButton8.setBackground(Color.MAGENTA);
jButton9.setBackground(Color.MAGENTA);
}
if (b1==("O") && b4 == ("O") && b7 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton1.setBackground(Color.MAGENTA);
jButton4.setBackground(Color.MAGENTA);
jButton7.setBackground(Color.MAGENTA);
}
if (b2==("O") && b5 == ("O") && b8 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton2.setBackground(Color.MAGENTA);
jButton5.setBackground(Color.MAGENTA);
jButton8.setBackground(Color.MAGENTA);
}
if (b3==("O") && b6 == ("O") && b9 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton3.setBackground(Color.PINK);
jButton6.setBackground(Color.PINK);
jButton9.setBackground(Color.PINK);
}
if (b1==("O") && b5 == ("O") && b9 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton1.setBackground(Color.PINK);
jButton5.setBackground(Color.PINK);
jButton9.setBackground(Color.PINK);
}
if (b3==("O") && b5 == ("O") && b7 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton3.setBackground(Color.PINK);
jButton5.setBackground(Color.PINK);
jButton7.setBackground(Color.PINK);
}
To support more videos from DJ Oamen, visit POamen Paypal
paypal.me/POamen
To Become a Channel member click on the Link below to JOIN:
youtube.com/channel/UCFtw9CfTfMKU9aHZsT2teYg/jo…
Winning Solution for Player O below:
if (b1==("O") && b2 == ("O") && b3 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton1.setBackground(Color.PINK);
jButton2.setBackground(Color.PINK);
jButton3.setBackground(Color.PINK);
}
if (b4==("O") && b5 == ("O") && b6 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton4.setBackground(Color.YELLOW);
jButton5.setBackground(Color.YELLOW);
jButton6.setBackground(Color.YELLOW);
}
if (b7==("O") && b8 == ("O") && b9 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton7.setBackground(Color.MAGENTA);
jButton8.setBackground(Color.MAGENTA);
jButton9.setBackground(Color.MAGENTA);
}
if (b1==("O") && b4 == ("O") && b7 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton1.setBackground(Color.MAGENTA);
jButton4.setBackground(Color.MAGENTA);
jButton7.setBackground(Color.MAGENTA);
}
if (b2==("O") && b5 == ("O") && b8 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton2.setBackground(Color.MAGENTA);
jButton5.setBackground(Color.MAGENTA);
jButton8.setBackground(Color.MAGENTA);
}
if (b3==("O") && b6 == ("O") && b9 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton3.setBackground(Color.PINK);
jButton6.setBackground(Color.PINK);
jButton9.setBackground(Color.PINK);
}
if (b1==("O") && b5 == ("O") && b9 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton1.setBackground(Color.PINK);
jButton5.setBackground(Color.PINK);
jButton9.setBackground(Color.PINK);
}
if (b3==("O") && b5 == ("O") && b7 == ("O"))
{
JOptionPane.showMessageDialog(this,"Player O Wins", "Tic Tac Toe",JOptionPane.INFORMATION_MESSAGE);
oCounter++;
gameScore();
jButton3.setBackground(Color.PINK);
jButton5.setBackground(Color.PINK);
jButton7.setBackground(Color.PINK);
}
About this tutorial
DJ Oamen published this 38:39 video tutorial on November 11, 2017. It has been watched 144,008 times on YouTube.
Tags
Share
This tutorial in other languages
- FRComment faire pour créer un jeu de Tic Tac Toe en Java NetBeans
- ESCómo crear un juego de Tic Tac Toe en NetBeans Java
- PTComo criar um jogo Tic Tac Toe em Java NetBeans
- ITCome creare un Gioco della punta di Tic Tac in Java NetBeans
- DEWie ein Tic Tac Toe-Spiel in Java NetBeans erstellen
- NLHoe maak je een Tic Tac Toe Game in Java NetBeans aanmaken
- RUКак создать Tic Tac Toe игры в Java NetBeans
- PLJak utworzyć Tic Tac Toe gry w Java NetBeans
- JAJavaのNetBeansの中でチックタックトーのゲームを作成する方法
- ARكيفية إنشاء لعبة تو تيك تاك في جافا نتبيانس
- HIकैसे जावा NetBeans में एक टिक टैक टो खेल बनाने के लिए
- IDCara Membuat Toe permainan Tic Tac di Jawa NetBeans