Código:
Hola amigos, me dejaron de tarea programar un juego de XO para mi clase pero estoy teniendo problemas para acabarloCódigo:A mi parecer el codigo esta correcto, pero no estoy seguro en que parte debe ir ubicado.public class TicTacToe extends javax.swing.JFrame { public TicTacToe() { initComponents(); } jRadioButton2 = new javax.swing.JRadioButton(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton8 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); jButton10 = new javax.swing.JButton(); jButton11 = new javax.swing.JButton(); jButton12 = new javax.swing.JButton(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton3 = new javax.swing.JRadioButton(); int count = 2; boolean ganador = false; boolean empate = false; private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if (jRadioButton1.isSelected()) { if (count % 2 == 0) { count++; jButton1.setText("X"); jButton1.setEnabled(false); } else { count++; jButton1.setText("O"); jButton1.setEnabled(false); } } else { if (jRadioButton3.isSelected()) { if ((count % 2 == 0)) { count++; jButton1.setText("O"); jButton1.setEnabled(false); } else { count++; jButton1.setText("X"); jButton1.setEnabled(false); } } } } private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: JOptionPane.showMessageDialog(null, "Seleccione ( X ) o ( O )"); } private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: System.exit(0); } private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if (jRadioButton1.isSelected()) { jButton1.setEnabled(true); jButton2.setEnabled(true); jButton3.setEnabled(true); jButton4.setEnabled(true); jButton5.setEnabled(true); jButton6.setEnabled(true); jButton7.setEnabled(true); jButton8.setEnabled(true); jButton9.setEnabled(true); } } private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if (jRadioButton3.isSelected()) { jButton1.setEnabled(true); jButton2.setEnabled(true); jButton3.setEnabled(true); jButton4.setEnabled(true); jButton5.setEnabled(true); jButton6.setEnabled(true); jButton7.setEnabled(true); jButton8.setEnabled(true); jButton9.setEnabled(true); } } private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: jButton1.setText(""); jButton1.setEnabled(false); jButton2.setText(""); jButton2.setEnabled(false); jButton3.setText(""); jButton3.setEnabled(false); jButton4.setText(""); jButton4.setEnabled(false); jButton5.setText(""); jButton5.setEnabled(false); jButton6.setText(""); jButton6.setEnabled(false); jButton7.setText(""); jButton7.setEnabled(false); jButton8.setText(""); jButton8.setEnabled(false); jButton9.setText(""); jButton9.setEnabled(false); jRadioButton1.setSelected(false); jRadioButton3.setSelected(false); } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TicTacToe().setVisible(true); } }); } if(jButton1.getText().equals(jButton2.getText()) && jButton2.getText().equals(jButton3.getText()) &! jButton1.getText().equals ("")) { JOptionPane.showMessageDialog(null,"X"); } if(jButton4.getText().equals(jButton5.getText()) && jButton5.getText().equals(jButton6.getText()) &! jButton4.getText().equals ("")) { JOptionPane.showMessageDialog(null,"X"); } if(jButton7.getText().equals(jButton8.getText()) && jButton8.getText().equals(jButton9.getText()) &! jButton7.getText().equals ("")) { JOptionPane.showMessageDialog(null,"X"); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton10; private javax.swing.JButton jButton11; private javax.swing.JButton jButton12; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JButton jButton7; private javax.swing.JButton jButton8; private javax.swing.JButton jButton9; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton jRadioButton2; private javax.swing.JRadioButton jRadioButton3; // End of variables declaration }Código:Ayudenme porfaif(jButton1.getText().equals(jButton2.getText()) && jButton2.getText().equals(jButton3.getText()) &! jButton1.getText().equals ("")) { JOptionPane.showMessageDialog(null,"X"); } if(jButton4.getText().equals(jButton5.getText()) && jButton5.getText().equals(jButton6.getText()) &! jButton4.getText().equals ("")) { JOptionPane.showMessageDialog(null,"X"); } if(jButton7.getText().equals(jButton8.getText()) && jButton8.getText().equals(jButton9.getText()) &! jButton7.getText().equals ("")) { JOptionPane.showMessageDialog(null,"X"); }