Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface Draw {
- void drawLine(double x1, double y1, double x2, double y2);
- }
- public class DrawUtil {
- public static void drawBox(Draw draw, double x1, double y1, double width, double height) {
- draw.drawLine(x1, y1, x1 + width, y1);
- draw.drawLine(x1 + width, y1, x1 + width, y1 + height);
- draw.drawLine(x1 + width, y1 + height, x1, y1 + height);
- draw.drawLine(x1, y1 + height, x1, y1);
- }
- }
- public class SwingDraw implements Draw {
- // some code here
- }
- public class DXFDraw implements Draw {
- // some code here
- }
- public class MyThing {
- // drawMyThing can draw to the screen and be exported to DXF
- public void drawMyThing(Draw draw) {
- // some code here
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement