|
|
DrawArea
DrawArea extends JLabel and implements our custom painting. We override
the paintComponent() method of DrawArea so that our custom drawing is
done when the JRE needs to draw our component. It has attributes turtle
which tells the current state of turtle. The final(constant) values background
and ink tell about the color with which we must paint foreground and background.
It has methods relating to the various commands given to the Logo engine
such as forward(), home(), penerase() etc.
public class DrawArea extends JLabel{
java.util.List l=new ArrayList();//lines to draw
Turtle t=new Turtle();
final Color background=Color.white;
final Color ink=Color.black;
…………….
public void makeBlank(){
…….
public void paintComponent(Graphics g){
…….
And
public void forward(int moves){……
public void backward(int moves){……
etc.
to next chapter >>>
|