Results 1 to 3 of 3
  1. #1
    Wizard0860 is offline Member
    Join Date
    Nov 2012
    Posts
    29
    Rep Power
    0

    Default I need help with Graphics

    Hey i need help with changing the background in this code. how can i do it? I am using the subclass FlowerTurtle of Turtle, and don't get how to change the background color from its default green, or the color when the turtle moves. Please help, need for school.

    //Name______________________________ Date_____________
    import edu.fcps.Turtle;
    import java.awt.Color;
    import javax.swing.*;
    import java.awt.*;
    public class Driver08
    {


    public static void main(String[] args)
    {
    JFrame frame = new JFrame("Polygon Turtles");
    frame.setSize(400, 400);
    frame.setLocation(200, 100);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
    frame.setContentPane(new TurtlePanel());
    frame.setVisible(true);


    for(double i=75.0; i<=775.0; i+=150)
    {
    FlowerTurtle john = new FlowerTurtle(i, 50.0, Color.WHITE, 30);
    john.setColor(Color.RED);
    while(i==225)
    {
    john.setColor(Color.RED);
    john.drawShape();
    }
    john.drawShape();
    }
    }
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: I need help with Graphics

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: I need help with Graphics

    Quote Originally Posted by Wizard0860 View Post
    I am using the subclass FlowerTurtle of Turtle
    Since there's no Turtle class in the standard JDK, you might want to ask wherever you got that class.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. help with Graphics 2D
    By jwl in forum New To Java
    Replies: 1
    Last Post: 11-06-2012, 06:14 PM
  2. Graphics 2D
    By scopene in forum Java 2D
    Replies: 0
    Last Post: 03-26-2012, 02:21 AM
  3. Drawing a graphics onto another Graphics ?
    By Ziden in forum Java Applets
    Replies: 0
    Last Post: 01-08-2011, 08:30 PM
  4. How to use graphics
    By Mattedatten in forum New To Java
    Replies: 3
    Last Post: 03-18-2010, 03:10 PM
  5. Help with 2d graphics please
    By xbox_nutter in forum New To Java
    Replies: 0
    Last Post: 04-02-2009, 12:48 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
  •