Color Question

Posted on 2005-04-24
Last Modified: 2010-03-31

I'm trying to create a chess game and I'm trying to implement the chessboard here's what I got :

            for (int i=1; i<=8; i++) {
                  for(int j=1; j<=8; j++ ) {
                        board = new JPanel();

I'm trying to set the colors of each block to white and green just any ordinary chess board. How will I be able to do it in my codes ? thanks.
Question by:rajah_mohammed
    LVL 16

    Accepted Solution


    Please have a look at this URL.


    Author Comment

    Thanks got it from you link :
    if((int)(i+j)/2==(int)(i+j+1)/2) {
    LVL 16

    Expert Comment

    Glad I could help.


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    Video by: Michael
    Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now