All pastes #359762 Raw Edit

Stuff

public text v1 · immutable
·published 2007-02-17 01:27 UTC
rendered paste body
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.*;

public class CF extends JFrame implements ActionListener
{
	private JButton buttons[][];
	private int turn;

	private BorderLayout layout;

	public void CheckWin()
	{
		

	}

	public CF()
	{
		super("Connect Freaking Five");
		layout=new BorderLayout(25,25);

		Container container=getContentPane();
		container.setLayout(layout);

		buttons=new JButton[25][25];

		for(int x=0;x<25;x++)
		{
			for(int y=0;y<25;y++)
			{
				buttons[x][y]=new JButton(" ");
				buttons[x][y].addActionListener(this);
			}
		}
		for(int x=0;x<25;x++)
		{
			for(int y=0; y<25;y++)
			{
				container.add(buttons[x][y]);
			}
		}

		setSize(800,600);
		setVisible(true);
	}

	public void actionPerformed(ActionEvent event)
	{
		for(int x=0;x<25;x++)
		{
			for(int y=0;y<25;y++)
			{
				if((event.getSource()==buttons[x][y])&&((buttons[x][y]).getText()).equals(" "))
					if (turn%2==0)
						buttons[x][y].setText("X");
					else buttons[x][y].setText("O");
			}
		}
	}

	public static void main (String args[])
	{
		CF application=new CF();
		application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

}