
-----------------------------------
xHoly-Divinity
Mon Sep 12, 2005 5:56 pm

Quick question. How to change color?
-----------------------------------

import java.awt.*;
import hsa.Console;

public class Blah
{
    static Console c;
    
    public static void main (String[] args)
    {
        c = new Console ();
        c.fillOval (200, 200, 100, 100);
    } 
} 


where the command "c.fillOval (200, 200, 100, 100);" how would I change the colour from being black to say white/green/blue/red/yellow?

-----------------------------------
Cervantes
Mon Sep 12, 2005 6:15 pm


-----------------------------------
If I remember correctly, you merely have to call the setColor method of the Console, providing it with one arguement:

c.setColor(red);

Standard colours, such as red, are built in objects and you don't have to create a new Color object.  If you want to use a specific colour with your own specific RGB values, you must create a new Color object:

Color myColour = new Color(redComp, greenComp, blueComp);
c.setColor(myColour);


-----------------------------------
xHoly-Divinity
Mon Sep 12, 2005 6:18 pm


-----------------------------------
Thank You!  :-)

-----------------------------------
1of42
Mon Sep 12, 2005 10:01 pm


-----------------------------------
For the record, the built-in colors are all static members of the Color class, such as:

Color.RED, Color.BLACK, Color.BLUE etc.
