Guest User

Untitled

a guest
Feb 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. // Här har vi ett interface som är lokalt
  2. // för denna klass. Lite exotiskt kanske...
  3. interface Draw
  4. {
  5. public void draw(Graphics g);
  6. }
  7.  
  8. class GoLeftPainter implements Draw
  9. {
  10. public void draw(Graphics g)
  11. {
  12. g.drawImage
  13. (
  14. icon.getImage(),
  15. // Destination coordinates:
  16. rect.x + rect.width,
  17. rect.y,
  18. rect.x,
  19. rect.y + rect.height,
  20. // Source coordinates:
  21. 0,
  22. 0,
  23. rect.width,
  24. rect.height,
  25. null
  26. );
  27. }
  28. }
  29.  
  30. class GoRightPainter implements Draw
  31. {
  32. public void draw(Graphics g)
  33. {
  34. g.drawImage
  35. (
  36. icon.getImage(),
  37. // Destination coordinates:
  38. rect.x,
  39. rect.y,
  40. rect.x + rect.width,
  41. rect.y + rect.height,
  42. // Source coordinates:
  43. 0,
  44. 0,
  45. rect.width,
  46. rect.height,
  47. null
  48. );
  49. }
  50. }
Add Comment
Please, Sign In to add comment