|
new.member
Group: Members Joined: 14 Apr, 2007 Posts: 19
My Contributions
Two questions-
1. -I now know how to move my polygons horizontallly but how do I move them veritically???
2. Also I need to label my graphics--not sure how to do that. I attempted one of the graphics but got no result. I need to label ---square, rounded square, polygon, circle, oval, filled rectaangle and filled circle.
Here is my code
import java.applet.*; import java.awt.*; public class Project3Applet extends Applet {
public void paint(Graphics gr) { Label grapicName = new Label("square"); Font bigFont = new Font("Helvetica", Font.BOLD,12); gr.setFont(bigFont); gr.setColor(Color.blue); setBackground(Color.white); gr.drawRoundRect(20,20,80,80,0,0);
gr.drawRoundRect(20,20,80,80,0,0); gr.setColor(Color.magenta); setBackground(Color.white);
gr.drawRoundRect(220,20,80,80,40,40); gr.setColor(Color.cyan); setBackground(Color.white);
gr.drawRoundRect(20,180,80,80,80,80); gr.setColor(Color.green); setBackground(Color.white); gr.drawOval(190,190,120,60);
gr.setColor(Color.red); setBackground(Color.white); gr.drawRoundRect(20,320,75,75,80,80);
gr.setColor(Color.orange); setBackground(Color.white); gr.fillRect(200,330,120,60);
int xPoints[] = {162,172,192,172,180,160,135,148,129,152,162}; int yPoints[] = {158,180,188,200,235,205,222,195,178,180,158}; gr.setColor(Color.black); gr.drawPolygon(xPoints, yPoints, xPoints.length); } }
Thanks for the help
|