0

Hi I was wondering if anyone knows why I'm getting the reached end of file while parsing error. It mentions the bracket at the end of the file however when I remove it I get loads of errors. I know that I need to remove it however i dont understand why this error is occuring...

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class DrawPanel extends JPanel implements MouseListener
	{
		public int numCols;
		public int numRows;

		public DrawPanel(int nc, int nr)
		{
			numCols = nc;
			numRows = nr;
			addMouseListener(this);
		}
		int getCol(int x)
		{
			return x*newCol/getWidth();
		}
		int getRow(int y)
		{
			return y*newRow/getHeight();
		}

		public void mouseReleased(MouseEvent event)
		{
		}
		public void mousePressed(MouseEvent event)
		{
		}
		public void mouseClicked(MouseEvent event)
		{
			int thisCol = getCol(event.getX());
			model.go(thisCol);

			if(model.autoplay == 1)
			{
				System.out.println("Two Player game");
			}
			else if(model.autoplay == 2)
			{

				thisCol = model.getSuggestedMove(model.getNextPlayer());
				model.go(thisCol);
			}
			else if(model.autoplay == 3)
			{
				thisCol = model.getSuggestedMove(model.getNextPlayer());
				model.go(thisCol);
			}
			
			repaint();

		}
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by BestJewSinceJC
1

You need one more closing bracket; you have more opening brackets than closing right now. Put another closing bracket after line 53.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.