About my class and why it's not detecting java.awt.Color?
I've got a issue with the program I'm writing - this is an APCS A class so
there is an APCS.lib - it includes the DrawingTool Class that is used in
the program. I'm having issues with the import java.awt.Color statement:
There is a driver that is executed for the entire program but my question
is in the line import java.awt.Color; and line 33 - pencil.SetColor(Color,
red); . Not sure my drjava is not detecting that java.awt.color import and
still giving me a "cannot find symbol/variable error." The program draws a
house.
//Name£∫ Allen Li
//Date: Monday, September 9th, 2013
//Purpose: Using apcslib to draw a house on with a piece of paper and pencil.
import apcslib.*;
import java.awt.Color;
public class DrawHouse{
private DrawingTool pencil;
private SketchPad paper;
/**
* Basic constructor for DrawHouse.
* Instantiates paper and pencil to basic
* values.
*/
public DrawHouse(){
paper = new SketchPad(300, 400);
pencil = new DrawingTool(paper);
}
/**
* The draw method for the DrawHouse class.
* This method will run all of the
* commands necessary to draw the house.
*
*/
public void draw(){
// draw the main house
pencil.setWidth(3);
pencil.setColor(Color, red);
pencil.down();
pencil.move(-100,0);
pencil.move(-100,100);
pencil.move(100,100);
pencil.move(100,0);
pencil.move(0,0);
//door
pencil.up();
pencil.move(-20,0);
pencil.down();
pencil.move(-20,50);
pencil.move(20,50);
pencil.move(20,0);
//roof
pencil.up();
pencil.move(-100,100);
pencil.down();
pencil.move(0,150);
pencil.move(100,100);
//window left
pencil.up();
pencil.move(-70, 60);
pencil.down();
pencil.move(-40, 60);
pencil.move(-40, 90);
pencil.move(-70, 90);
pencil.move(-70, 60);
//window right
pencil.up();
pencil.move(70,60);
pencil.down();
pencil.move(40,60);
pencil.move(40,90);
pencil.move(70,90);
pencil.move(70,60);
pencil.up();
}
}
No comments:
Post a Comment