Results 1 to 5 of 5
Thread: I need help with Graphics
- 11-17-2012, 02:30 AM #1
Member
- Join Date
- Nov 2012
- Posts
- 29
- Rep Power
- 0
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();
}
}
}
- 11-17-2012, 08:52 AM #2
Re: I need help with Graphics
If you're forever cleaning cobwebs, it's time to get rid of the spiders.
- 11-17-2012, 09:05 AM #3
- 02-16-2017, 06:54 PM #4
Member
- Join Date
- Jan 2017
- Posts
- 5
- Rep Power
- 0
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!
- 02-16-2017, 07:42 PM #5
Similar Threads
-
help with Graphics 2D
By jwl in forum New To JavaReplies: 1Last Post: 11-06-2012, 05:14 PM -
Graphics 2D
By scopene in forum Java 2DReplies: 0Last Post: 03-26-2012, 01:21 AM -
Drawing a graphics onto another Graphics ?
By Ziden in forum Java AppletsReplies: 0Last Post: 01-08-2011, 07:30 PM -
How to use graphics
By Mattedatten in forum New To JavaReplies: 3Last Post: 03-18-2010, 02:10 PM -
Help with 2d graphics please
By xbox_nutter in forum New To JavaReplies: 0Last Post: 04-02-2009, 11:48 AM
Bookmarks