Advertisement
Guest User

Untitled

a guest
May 12th, 2014
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1.  
  2. import java.awt.Color;
  3. import java.awt.Graphics;
  4.  
  5. public abstract class Shape
  6. {
  7. private int x, y;
  8. private int x2, y2;
  9. private Color color;
  10.  
  11. public Shape(int x, int y, int x2, int y2, Color c)
  12. {
  13. this.x = x;
  14. this.y = y;
  15. this.x2 = x2;
  16. this.y2 = y2;
  17. color = c;
  18. }
  19.  
  20. public abstract void render(Graphics g);
  21.  
  22. public int calcWidth()
  23. {
  24. return x2 - x;
  25. }
  26.  
  27. public int calcHeight()
  28. {
  29. return y2 - y;
  30. }
  31.  
  32. public int getX()
  33. {
  34. return x;
  35. }
  36.  
  37. public void setX(int x)
  38. {
  39. this.x = x;
  40. }
  41.  
  42. public int getY()
  43. {
  44. return y;
  45. }
  46.  
  47. public void setY(int y)
  48. {
  49. this.y = y;
  50. }
  51.  
  52. public int getX2()
  53. {
  54. return x2;
  55. }
  56.  
  57. public void setX2(int x2)
  58. {
  59. this.x2 = x2;
  60. }
  61.  
  62. public int getY2()
  63. {
  64. return y2;
  65. }
  66.  
  67. public void setY2(int y2)
  68. {
  69. this.y2 = y2;
  70. }
  71.  
  72. public Color getColor()
  73. {
  74. return color;
  75. }
  76.  
  77. public void setColor(Color color)
  78. {
  79. this.color = color;
  80. }
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement