public static void main(String[] args) {
		final Point p = new Point(35,25);
		
		JFrame frame = new JFrame("PlayGrid class test");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		JPanel content = (JPanel) frame.getContentPane();
		GridBagLayout gb = new GridBagLayout();
		GridBagConstraints c = new GridBagConstraints();
		content.setLayout(gb);
		
		//The PlayGrid code
		final PlayGrid basic = new PlayGrid(50,50,5);
		basic.setPreferredSize(new Dimension(basic.getPixelWidth(),basic.getPixelHeight()));
		basic.setColor(p.x, p.y, Color.red);
		c.gridy = 0;
		c.gridx = 0;
		c.weighty = 1;
		content.add(basic,c);
		
		//Button navigation
		JPanel under = new JPanel();
		under.setLayout(new GridLayout(2,1));
		JPanel buttons = new JPanel();
		buttons.setLayout(new GridLayout(3,3));
		final JButton up = new JButton("Up");
		final JButton down = new JButton("Down");
		final JButton left = new JButton("Left");
		final JButton right = new JButton("Right");
		buttons.add(new JPanel());buttons.add(up);buttons.add(new JPanel());buttons.add(left);buttons.add(new JPanel());buttons.add(right);buttons.add(new JPanel());buttons.add(down);buttons.add(new JPanel());
		buttons.setPreferredSize(new Dimension(basic.getPixelWidth() + 5, 50));
		
		JPanel textContainer = new JPanel(new FlowLayout());
		final JLabel msgBox = new JLabel("No collisions!");
		textContainer.add(msgBox);
		
		under.add(buttons);
		under.add(textContainer);
		c.gridy = 1;
		c.weighty = 0;
		content.add(under,c);
	
		
		
		//Button actions
		ActionListener action = new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(e.getSource() == up)
					p.y--;
				if(e.getSource() == down)
					p.y++;
				if(e.getSource() == left)
					p.x--;
				if(e.getSource() == right)
					p.x++;
				
				if(basic.collides(p.x, p.y)) //do we hit something here other than background?
					msgBox.setText("You collided!");
				else msgBox.setText("No collisions!");
				String bleh = new String(percentLeft() + "%");
				msgBox.setText(bleh);
				basic.setColor(p.x, p.y, Color.red);
				basic.draw();
			}
		};
		up.addActionListener(action);
		down.addActionListener(action);
		left.addActionListener(action);
		right.addActionListener(action);
		
		
		frame.pack();
		frame.setVisible(true);
	}