Hey Gang;

I'm new at this college thing, it's been a while.
Need help trying to figure out why I am getting <identifier> errors.
Here's my script.
would sure appreciate any help you can give.
Thanks
/////////////////////////////////////////////////////////////////////////////////////

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class TicTacToe extends Frame
{
// Declaring the variables
	private Button keys[];
	private Panel keypad;
	private TextField winner, player1, player2;
	Private ButtonValue1;
	Private ButtonValue2;
	Private ButtonValue3;
	Private ButtonValue4;
	Private ButtonValue5;
	Private ButtonValue6;
	Private ButtonValue7;
	Private ButtonValue8;
	Private ButtonValue9;

public TicTacToe()
	{
// Creating the components of the menu bar.
		MenuBar mnuBar = new MenuBar();
		setMenuBar(mnuBar);

		// Creating the components of the File menu.
		Menu mnuFile = new Menu("File", true);
		mnuBar.add(mnuFile);
			MenuItem mnuFileExit = new MenuItem("Exit");
			mnuFile.add(mnuFileExit);

	// Creating the components of the Edit menu.
		Menu mnuEdit = new Menu("Edit", true);
		mnuBar.add(mnuEdit);
			MenuItem mnuEditClear = new MenuItem("Clear");
			mnuEdit.add(mnuEditClear);
			mnuEdit.insertSeparator(1);
			MenuItem mnuEditCopy = new MenuItem("Copy");
			mnuEdit.add(mnuEditCopy);
			MenuItem mnuEditPaste = new MenuItem("Paste");
			mnuEdit.add(mnuEditPaste);

	// Creating the components of the About menu.
		Menu mnuAbout = new Menu("About", true);
			mnuBar.add(mnuAbout);
			MenuItem mnuAboutCalculator = new MenuItem("About Tic Tac Toe");
			mnuAbout.add(mnuAboutCalculator);

// Creating the components ofthe game board.
		keypad = new Panel();
		keys = new Button[10];
		winner = new TextField("Player ");

	// construction and assigning of the buttons.
		for (int i=1; i<=9; i++)
			keys[i] = new Button();

// Constructing the layout.
		setLayout(new BorderLayout());
		keypad.setLayout(new GridLayout(3,3,1,1));

// Button assignments and color, buttuns will eventually be replaced by an image when selected.
		for (int i=1; i<=3; i++) // The first row.
			keypad.add(keys[i]).setBackground(Color.white);

		for (int i=4; i<=6; i++) // The second row.
			keypad.add(keys[i]).setBackground(Color.white);

		for (int i=7; i<=9; i++) // The third row.
			keypad.add(keys[i]).setBackground(Color.white);

// determining the location of the keypad and the text field.
		setBackground(Color.black); // The back ground color to get that true gride look.
		add(keypad, BorderLayout.CENTER);
		add(winner, BorderLayout.SOUTH);
	}
	public static void main(String[] args)
	{
		TicTacToe f = new TicTacToe();
		f.setTitle("Tic Tac Toe");
		f.setBounds(400,200,300,300);
		f.setVisible(true);
	}

static ButtonValue f = new ButtonValue();

	ButtonValueGroup options = new ButtonValueGroup();

		ButtonValue1 = new ButtonValue1("",false,options);
		ButtonValue2 = new ButtonValue2("",false,options);
		ButtonValue3 = new ButtonValue3("",false,options);
		ButtonValue4 = new ButtonValue4("",false,options);
		ButtonValue5 = new ButtonValue5("",false,options);
		ButtonValue6 = new ButtonValue6("",false,options);
		ButtonValue7 = new ButtonValue7("",false,options);
		ButtonValue8 = new ButtonValue8("",false,options);
		ButtonValue9 = new ButtonValue9("",false,options);

	public static String ColorButtons()
	{
		this.setLayout(new FlowLayout());
		add(Button1);
		add(Button2);
		add(Button3);
		add(Button4);
		add(Button5);
		add(Button6);
		add(Button7);
		add(Button8);
		add(Button9);
		Button1.addItemListener(this);
		Button2.addItemListener(this);
		Button3.addItemListener(this);
		Button4.addItemListener(this);
		Button5.addItemListener(this);
		Button6.addItemListener(this);
		Button7.addItemListener(this);
		Button8.addItemListener(this);
		Button9.addItemListener(this);

		//override windowClosing() allows user to click Close button
		addWindowListener(
			new WindowAdapter()
			{
				public void windowClosing(WindowEvent e)
				{
					System.exit(0);
				}
			}
		);
	} //end of construct method



	public void itemStateChanged(ItemEvent choice)
	{
		if (Player1.getState()) f.setBackground(JPEG_X);
			else if (Player2.getState()) f.setBackground(JPEG_O);

		repaint();
	} //end of actionPerformed method

} //end of class

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

the error is here

Private ButtonValue1;
Private ButtonValue2;
Private ButtonValue3;
Private ButtonValue4;
Private ButtonValue5;
Private ButtonValue6;
Private ButtonValue7;
Private ButtonValue8;
Private ButtonValue9;

replace it with:

Private Button Value1;
Private Button Value2;
Private Button Value3;
Private Button Value4;
Private Button Value5;
Private Button Value6;
Private Button Value7;
Private Button Value8;
Private Button Value9;

hope it hepls.

Or if your ButtonValue1 is the name of the variable the you should do lik this:

private Button ButtonValue1;
.....

Hey Montana;

Thanks for the tidbit of info.

I'll let you know if it works

This article has been dead for over six months. Start a new discussion instead.