Quick question. How to change color?
Author |
Message |
xHoly-Divinity
|
Posted: Mon Sep 12, 2005 5:56 pm Post subject: Quick question. How to change color? |
|
|
code: |
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? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Mon Sep 12, 2005 6:15 pm Post subject: (No subject) |
|
|
If I remember correctly, you merely have to call the setColor method of the Console, providing it with one arguement:
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:
RTP: |
Color myColour = new Color(redComp, greenComp, blueComp);
c.setColor(myColour);
|
|
|
|
|
|
|
xHoly-Divinity
|
Posted: Mon Sep 12, 2005 6:18 pm Post subject: (No subject) |
|
|
Thank You! |
|
|
|
|
|
1of42
|
Posted: Mon Sep 12, 2005 10:01 pm Post subject: (No subject) |
|
|
For the record, the built-in colors are all static members of the Color class, such as:
Color.RED, Color.BLACK, Color.BLUE etc. |
|
|
|
|
|
|
|