Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. //Michael Sylva
  2. //LAB05
  3. //100 Point Version
  4.  
  5. import java.applet.Applet;
  6. import java.awt.Graphics;
  7.  
  8. public class Lab05 extends Applet{
  9.  
  10. public void paint(Graphics g) {
  11. int width = 980;
  12. int height = 630;
  13. g.drawRect(10,10,width,height);
  14.  
  15. //draw bottom-right
  16. for(int i = 10; i<980; i+=10) {
  17. g.drawLine(i, height+10, width+10, (int) (height-(i*0.63)));
  18. }
  19.  
  20. //draw bottom-left
  21. for(int i = 980-10; i>0; i-=10) {
  22. g.drawLine(i, height+10, 10, (int) (i*0.63));
  23. }
  24.  
  25. //draw top right
  26. for(int i = 980-10; i>0; i-=10) {
  27. g.drawLine(i, 10, width+10, (int) (i*0.63));
  28. }
  29.  
  30. //draw top left
  31. for(int i = 980-10; i>0; i-=10) {
  32. g.drawLine(i, 10, 10, (int) (height-(i*0.63)));
  33. }
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement