Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public interface Draw {
  2. void drawLine(double x1, double y1, double x2, double y2);
  3. }
  4.  
  5.  
  6. public class DrawUtil {
  7. public static void drawBox(Draw draw, double x1, double y1, double width, double height) {
  8. draw.drawLine(x1, y1, x1 + width, y1);
  9. draw.drawLine(x1 + width, y1, x1 + width, y1 + height);
  10. draw.drawLine(x1 + width, y1 + height, x1, y1 + height);
  11. draw.drawLine(x1, y1 + height, x1, y1);
  12. }
  13. }
  14.  
  15.  
  16. public class SwingDraw implements Draw {
  17. // some code here
  18. }
  19.  
  20. public class DXFDraw implements Draw {
  21. // some code here
  22. }
  23.  
  24. public class MyThing {
  25. // drawMyThing can draw to the screen and be exported to DXF
  26. public void drawMyThing(Draw draw) {
  27. // some code here
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement