Results 1 to 5 of 5
  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
    12,042
    Rep Power
    23

    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
    12,042
    Rep Power
    23

    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.

  4. #4
    nfalato is offline Member
    Join Date
    Jan 2017
    Posts
    5
    Rep Power
    0

    Default Re: I need help with Graphics

    So I also need help with Graphics with a Turtle.java...
    I'm very lost on how to start off this particular piece of code because I am supposed to create a radial figure of 360 lines. The line starts at the middle of where the little turtle is and will go out x amount of pixels I would set it to and go back to the middle until it's reached a full 360 circle. Something I have no idea on how to do is how to get the full rainbow of colors in this circle (red - purple) with varying shades of each color depending on the angle that the turtle is facing...a code that I was given to help with figuring this out said that the line drawn at angle, ang, has the HSB/HSV color of (ang / 360, 1, 1)
    ...I am very lost and any notes or links to documents that can potentially help me will be greatly appreciated!

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,042
    Rep Power
    23

    Default Re: I need help with Graphics

    1. Don't wake the zombies. Get your own thread -- they're free.
    2. Seeing as you found this thread, how come you didn't bother to read #3?

    db

    THREAD CLOSED
    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, 01: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, 11:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •