Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: how to set a new color in gridworld

  1. #1
    Member
    Join Date
    Aug 2013
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to set a new color in gridworld

    Hi, I've been using grid world with my school. It's a part of the eimacs textbook. Could I please have some help with the following code that I wrote for gridworld. It's a very small tad bit of code:

     
    Actor actor = new Actor();
    actor.putSelfInGrid( grid, new Location( 5, 3 ) );
     
    public void setColor (Color RED);

    I get the following error:

    error: illegal start of expression
     
    public void setColor (Color RED);


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: how to set a new color in gridworld

    "Color RED" is not valid. Perhaps it should be Color.RED. There may be other errors as in mismatched or missing braces, but I can't tell that with the code you've posted.

  3. #3
    Member
    Join Date
    Aug 2013
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to set a new color in gridworld

    I got it to work, but sure enough I have another gridworld question that is really a different thread so that's where I'm gonna post it.

Similar Threads

  1. Replies: 6
    Last Post: September 15th, 2013, 07:18 PM
  2. GridWorld
    By keepStriving in forum Java Theory & Questions
    Replies: 5
    Last Post: May 10th, 2013, 01:27 PM
  3. text color changer based on words/ word classification by color
    By knoxy5467 in forum Java Theory & Questions
    Replies: 25
    Last Post: June 15th, 2011, 07:52 AM
  4. set Background Excel cell color using POI API
    By ngamal in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 26th, 2011, 11:20 AM
  5. GridWorld Code - Need Help
    By prodigytoast in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 3rd, 2010, 09:02 PM

Tags for this Thread