Results 1 to 3 of 3

Thread: Changing colors

  1. #1
    Join Date
    Apr 2013
    Rep Power

    Default Changing colors

    So.. how exactly would you alter the color of just one object?
    for instance say i have the following in my graphics method:

    Java Code:
    g.drawString("Knights Ammo: "+kammo, 5, 10);
    g.drawOval(knightPositionX -5, knightPositionY -5, aw[0], ah[0]);
    how would i make it so the String stays in white but the oval is drawn in say red?
    ive tried implementing this
    Java Code:
    but it seems to make all my text red.. which i dont want.
    help please, thanks!

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Changing colors

    Before you draw the String, set the color to Color.WHITE and before you draw the oval, set the color to Color.RED.

    kind regards,

    The only person who got everything done by Friday was Robinson Crusoe.

  3. #3
    Join Date
    Apr 2013
    Rep Power

Similar Threads

  1. Replies: 2
    Last Post: 11-10-2012, 11:27 AM
  2. How do i add colors
    By ytrewqc in forum New To Java
    Replies: 1
    Last Post: 11-01-2011, 03:15 PM
  3. Replies: 0
    Last Post: 08-14-2010, 10:09 AM
  4. Rectangle and Colors
    By urbim in forum Java Applets
    Replies: 0
    Last Post: 07-11-2009, 03:03 PM
  5. Changing colors of an image in real time
    By chale in forum CLDC and MIDP
    Replies: 0
    Last Post: 05-06-2009, 03:04 PM

Posting Permissions

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