Results 1 to 1 of 1
  1. #1
    vicu1 is offline Member
    Join Date
    Nov 2011
    Posts
    19
    Rep Power
    0

    Default basic connect four problem

    hi so i am doing a connect four game and i just want to know how i can get a board to display and the pieces to drop down. i have never done this so i dont really understand how to do it. any help would be appreciated :)

    this is what i have so far
    [
    Java Code:
    package connect;
    
    import java.awt.Image;
    import javax.swing.*;
    
    import BreezySwing.*;
    
    public class ConnectFour extends GBFrame
    {
    	private JLabel title;
    	private JLabel celsiusLabel;
    	private DoubleField fahrenheitField;
    	private DoubleField celsiusField;
    	private JButton fahrenheitButton;
    	private JButton celsiusButton;
    	private JButton column1;
    	private JButton column2;
    	private JButton column3;
    	private JButton column4;
    	private JButton column5;
    	private JButton column6;
    	public ImageIcon Icon;
    	public Image Image;
    	private int[][] grid;
    	public ConnectFour()
    	{
    		title = addLabel ("Connect Four" , 1,3,1,1);
    		column1 = addButton ("column1" , 2,1,1,1);
    		column2 = addButton ("column2" , 2,2,1,1);
    		column3 = addButton ("column3" , 2,3,1,1);
    		column4= addButton ("column4" , 2,4,1,1);
    		column5 = addButton ("column5" , 2,5,1,1);
    		column6 = addButton ("column6" , 2,6,1,1);
    		// create the grid
    		grid = new int[7][6];
    		// initialize the grid
    		for (int row=0; row<6; row++)
    		{
    			for (int column=0; column<7; column++)
    			{
    				grid[column][row] = 0;
    			}
    		
    		}
    		Icon = new ImageIcon("http://www.totalevolutions.co.uk/Board5Connect4.png "); // this is part i dont understand what to do with 
    		Image = Icon.getImage();
    	}
    	
    	
    	
    	public static void main(String[] args)
    	{
    		ConnectFour theGUI = new ConnectFour();
    		theGUI.setSize (550, 200);
    		theGUI.setVisible (true);
    	}
    
    }
    Last edited by vicu1; 06-02-2012 at 06:04 AM.

Similar Threads

  1. Basic Problem
    By odd123 in forum New To Java
    Replies: 6
    Last Post: 03-18-2012, 03:37 AM
  2. Very basic problem with a for loop.
    By Actaeonis in forum New To Java
    Replies: 5
    Last Post: 11-18-2011, 08:22 PM
  3. Very basic java problem
    By mrparker2 in forum New To Java
    Replies: 6
    Last Post: 05-26-2011, 09:50 PM
  4. What am I doing wrong in this basic problem
    By Blaedel in forum New To Java
    Replies: 10
    Last Post: 10-11-2009, 08:45 PM
  5. Problem to connect Database
    By Swamipsn in forum NetBeans
    Replies: 1
    Last Post: 08-07-2007, 08:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •