import java.awt.event.*; import javax.swing.*; import tict.TicTGui; import tict.TicTGui; public class TicT { /* Variables*/ private javax.swing.JButton button1; private javax.swing.JButton button2; private javax.swing.JButton button3; private javax.swing.JButton button4; private javax.swing.JButton button5; private javax.swing.JButton button6; private javax.swing.JButton button7; private javax.swing.JButton button8; private javax.swing.JButton button9; private javax.swing.JFrame jFrame1; private String letter = ""; public static int count = 0; /*Make The Window Visible*/ public void run() { new TicTGui().setVisible(true); setCount(1); } // constructor that accepts a TicTGui object public TicT( TicTGui ticTGui ) { this.ticTGui = ticTGui; } // end constructor private void setCount(int i) { throw new UnsupportedOperationException("Not yet implemented"); } /*Calculate Who's Turn It Is*/ public int WhoToPlay() { if(count == 1 || count == 3 || count == 5 || count == 7 || count == 9|| count == 11) { letter = "X"; } else if(count == 2 || count == 4 || count == 6 || count == 8 || count == 10) { letter = "O"; } return count; } /*checking who plays*/ public void MakeYourMove(int count) { for(int i=0;i<=9;i++) { if(count==1) { String input = JOptionPane.showInputDialog("welcome you will take X and computer wiil take O \n Please ENTER number you want to play "); int pawn = Integer.parseInt(input); //set letter to choosen buttons switch (input) { case "1": ticTGui.setButton1Text( "X" ); ticTGui.setButton1Enabled( false ); break; case "2": ticTGui.setButton2Text( "X" ); ticTGui.setButton2Enabled( false ); break; default: JOptionPane.showInputDialog("Sorry invalid number entered Please enter a number from 1 to 9 \n Press enter to procced "); break; } } //generating a number to be played by computer int ran = 1 + (int)(Math.random() * 9); //else if(count==2) { if (ran==1) { button1.setText("O"); button1.setEnabled(false); } else if(ran==2) { button2.setText("O"); button2.setEnabled(false); } else if(ran==3) { button3.setText("0"); button3.setEnabled(false); } else if(ran==4) { button4.setText("0"); button4.setEnabled(false); } else if(ran==5) { button5.setText("0"); button5.setEnabled(false); } else if(ran==6) { button6.setText("O"); button6.setEnabled(false); } else if(ran==7) { button7.setText("X"); button7.setEnabled(false); } else if(ran==8) { button8.setText("X"); button8.setEnabled(false); } else if(ran==9) { button9.setText(letter); button9.setEnabled(false); } } } } public static void main(String args[]) { /* * Create and display the form on the EDT */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TicTGui(); } }); } // end method main() }
why m i getting ann error"cannot find symbol TicTGui " where i am creating constructor that accepts a TicTGui object
as well as in my switch statements " ticTGui.setButton1Text( "X" ); "
"ticTGui.setButton1Enabled( false );"