Home
Complete Archive
RSS XML
Contact
Search

Popular Posts
Obama Stickers
Environmentally Friendly Coffins
Battery Powered Led Christmas Lights
Bunhill Fields Cemetery
Led Icicle Christmas Lights
Fall Flowers
Wicker Casket
Brown Christmas Tree

Blogroll
Card Boat
Gift Clicks
Health Supply
Health Drugs
Crisp Healthcare
Healthy Senses
Health Directs
Still Healthy
Healthcare Topic
Bicycle Island
Scribblers
Paint Boxes

Marketplace

3 Red Roses

Posted on March 5, 2010.
3 Red Roses[Graphics java] How can you add loops circles?

its transfer to our fearless leader in my computer class SCI
So far, I'm almost finished, except for circles around him (frames)
here's an example:
http://academics.tjhsst.edu/compsci/CSweb/Unit2/Lab02/Applet02.html

I have no idea how to do loops circles, can someone help me please? THANK

import javax.swing .*;
import java.awt .*;
Public class JPanel extends Panel02
(
public void paintComponent (Graphics g)
(

super.paintComponent (g);
g.setColor (Color.red.darker ());
g.fillRect (0, 0, 400, 325);

Pink = new ImageIcon ImageIcon ("rose.jpg");
g.drawImage (rose.getImage (), 100, 50, 190, 190, null);


for (int k = 0, <k = 400, + k = 15)
(
g.fillOval (k, 25 k, 30);
g.setColor (Color.blue.darker ());

)


)

If I was given this assignment I would create a sort of loop as follows:

/ / You have a grid of 8 x 10 oval
ovalWidth int = 20;
int ovalHeight = 20;
ovalX int = 0;
Ovaly int = 0;

/ / For each of 10 lines
for (int i = 0; i <10; i + +) (

Attracting .......// 8 circles
....... For (int j = 0 j <8 j + +) (

.............. G.fillOval (ovalX, Ovaly, ovalWidth, ovalHeight);
.............. OvalX ovalWidth + =;

.......}
....... OvalX = 0;
....... Ovaly ovalHeight + =;
)

I have not tested but I think it would work. You may need to superimpose a fillRect to cover the gaps between the circles.

Share |

Comments

There are no comments.

Leave a Comment

Your Name
Your Email
Comments
Human Check. Type 5609.