Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import java.awt.*;
  2. import java.applet.*;
  3.  
  4.  
  5. public class Lab05 extends Applet
  6. {
  7. public void paint(Graphics g)
  8. {
  9.  
  10. int width = 980;
  11. int height = 630;
  12.  
  13. int x1 = 10;
  14. int y1 = 640;
  15. int x2 = 990;
  16. int y2 = 640;
  17. g.drawRect(10,10,width,height);
  18.  
  19. // hmm
  20.  
  21. for
  22. (int W = 0; W <= 50; W++)
  23. {
  24. g.drawLine(x1,y1,x2,y2);
  25. x1= x1 + width/50;
  26. y2= y2 - height/50;
  27. }
  28.  
  29.  
  30. for
  31. (int W = 0; W <= 50; W++)
  32. {
  33. g.drawLine(x2, y2, x1, y1);
  34. x2 = x2 - width/50;
  35. y1 = y1 - height/50;
  36. }
  37.  
  38. int nx1 = 10;
  39. int ny1 = 10;
  40. int nx2 = 990;
  41. int ny2 = 10;
  42. for
  43. (int W = 0; W <= 50; W++)
  44. {
  45. g.drawLine(nx1, ny1, nx2, ny2);
  46. nx2 = nx2 - width/50;
  47. ny1 = ny1 + height/50;
  48. }
  49.  
  50. for
  51. (int W = 0; W <= 50; W++)
  52. {
  53. g.drawLine(nx2, ny2, nx1, ny1);
  54. nx1 = nx1 + width/50;
  55. ny2 = ny2 + height/50;
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement