Advertisement
Guest User

251A4 appendix

a guest
May 25th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. /∗∗
  2. ∗ A sprite is a custom−painted component which moves , can be selected , can
  3. ∗ be resized , and can be recolored .
  4. ∗/
  5. public interface Sprite extends SpriteModel, SpriteView
  6. {
  7.  
  8. }
  9.  
  10.  
  11. public interface SpriteView
  12. {
  13.  
  14. /**
  15. * Customisable appearance.
  16. *
  17. * @param g
  18. * The graphics Context.
  19. */
  20. public abstract void paint(Graphics g);
  21.  
  22. public abstract void drawHandles(Graphics g);
  23. }
  24.  
  25.  
  26. public interface SpriteModel
  27. {
  28.  
  29. /**
  30. * Customisable movement.
  31. *
  32. * @param bW
  33. * width of movement area
  34. * @param bH
  35. * height of movement area
  36. */
  37. public abstract void move(int bW, int bH);
  38.  
  39. public abstract int getX();
  40.  
  41. public abstract int getY();
  42.  
  43. /**
  44. * Customisable selection
  45. *
  46. * @param p
  47. * selection pointer (e.g. from a mouse-click event)
  48. *
  49. * @return true, if p is within the sprite's selection area.
  50. */
  51. public abstract boolean contains(Point p);
  52.  
  53. public abstract void setSelected(boolean s);
  54.  
  55. public abstract boolean isSelected();
  56.  
  57. /**
  58. * Customisable size
  59. */
  60. public abstract int getWidth();
  61.  
  62. public abstract void setWidth(int w);
  63.  
  64. public abstract int getHeight();
  65.  
  66. public abstract void setHeight(int h);
  67.  
  68. /**
  69. * Customisable color
  70. */
  71. public abstract Color getStrokeColor();
  72.  
  73. public abstract void setStrokeColor(Color c);
  74.  
  75. public abstract Color getFillColor();
  76.  
  77. public abstract void setFillColor(Color c);
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement