Professional Documents
Culture Documents
C:AJsers/Kikik/Documents/NetBeaiisProjects/T icT
acT/src/ttt/T icT acT oeFrame.j ava /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ttt;
I ★*
*
* Gauthor Kikik */
public class TicTacToeFrame extends javax.swing.JFrame {
if {one != "" && two != "" && three != "" && four != "" && five != ""
&& six != "" && seven != "" && eight != "" && nine != "")
{
JOptionPane.showMessageDialog{this,
"GAME E ra kenek neh",
"OKE PANUTANKU",
JOptionPane.INFORMATI0N_MESSAGE);
resetGame();
}
}
private void setScoreO //pengaturan score pemain pada bawah bidang
{
jLabel_Score.setText(playerone + " perolehannya : "
+ String.valueOf(playeronecount) + " " + "\t " + playertwo
+ " perolehannya : " + String.valueOf{playertwocount));
}
private void getNamaPemain() //input nama pemain 1 dan pemain 2
{
playerone = JOptionPane.showInputDialog(this,
"Nama Pemain 1 -> ", // input nama pi
"NAMA PEMAIN", //judul pada bar
JOptionPane.INFORMATION_MESSAGE);
playertwo = JOptionPane.showInputDialog(this,
//kondisi X menang
if {one == "X" && two == "X" && three ==
"X")
xWins () ;
xWins () ;
xWins () ;
xWins () ;
xWins () ;
xWins () ;
xWins () ;
xWins () ;
}
//kondisi o menang
if {one — "O'* && two — "0" && three —
"0")
oWins () ;
oWins () ;
oWins () ;
oWins () ;
oWins () ;
oWins () ;
oWins () ;
oWins () ;
}
5.1 of 18 2017.11.22 00:50:25
C:AJsers/Kikik/Documents/NetBeaiisProjects/T icT acT/src/ttt/T icT acT oeFrame.j ava
}
j ★ ■*
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate=,,collapsed" desc="Generated Code">
private void initComponents{) {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Tic Tac Toe");
jPanel_2.add(jButton2, j ava.awt.BorderLayout.CENTER); j
Panel_GridHolder.add(j Panel_2);
java.awt.BorderLayout.CENTER); pack() ;
setLocationRelativeTo(null);
}// </editor-fold>
/**
* Sparam args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate^'collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeellnfo info : javax.swing.UIManager.getlnstalledLookAndFeels()) { if
("Nimbus".equals(info.getName{))) {
j
avax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger{TicTacToeFrame.class.getName()).log(java.util.logging.Level.SEVERE, n }
catch (InstantiationException ex) {
java.util.logging.Logger.getLogger{TicTacToeFrame.class.getName()).log(java.util.logging.Level.SEVERE, n }
catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger{TicTacToeFrame.class.getName()).log(java.util.logging.Level.SEVERE, n }
catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger{TicTacToeFrame.class.getName()).log(java.util.logging.Level.SEVERE, n
}
//</editor-fold>