Inside of your JFrame, you should have a JPanel as the content pane. Your subclass of JPanel should call paint() on the currently loaded Drawable objects. This will paint graphics into the application window.
Using this method your panel can paint the objects that implement the Drawable interface.
The objects that you must implement are:
The Group object also applies a scale, rotate, translate transform to its contents. The defaults are as shown above, which will do nothing. Rotation is expressed in degrees counter clockwise. Be sure to apply your transformations in the correct order (scale, rotate, translate). Note that groups can contain groups so you will need to build up the transformations.
Group{ contents: [ Line{ x1:10, y1:20, x2:20, y2:40, thickness:4, color: {r:0,g:0,b:0} }, Rect{ left:10, top:50, width:100, height:10, fill:{r:100,g:100,b:100} } ], rotate: 90.0, sx:0.5, sy:0.5, tx:0, ty:300 }
Group{ contents:[ Line{x1:10,y1:20,x2:30, y2:40, thickness:3, color:{r:255,g:255,b:0} }, Rect{ left:5,top:10,width:30, height:50, thickness:1, border:{r:0,g:0,b:0} }, Rect{ left:30,top:30,width:30, height:50, thickness:1, border:{r:0,g:0,b:0}, fill:{r:100,g:100,b:200} }, Ellipse{ left:5,top:70,width:30, height:50, thickness:1, border:{r:0,g:0,b:0} }, Ellipse{ left:30,top:90,width:30, height:50, thickness:1, border:{r:0,g:0,b:0}, fill:{r:100,g:100,b:200} }, Text{ text:"Hello", x:5,y:180,font:"sans-serif",size:10 }, Polyline{ points:[ {x:40,y:10}, {x:50,y:20}, {x:60,y:10} ], thickness:4, color:{r:100,g:255,b:100} }, Polygon{ points:[ {x:5,y:220}, {x:35,y:220}, {x:20,y:250} ], thickness:2, border:{r:0,g:0,b:0}, fill:{r:200,g:200,b:255} } ] }
Group{ contents:[ Line{x1:10,y1:20,x2:30, y2:40, thickness:3, color:{r:255,g:255,b:0} }, Rect{ left:5,top:10,width:30, height:50, thickness:1, border:{r:0,g:0,b:0} }, Rect{ left:30,top:30,width:30, height:50, thickness:1, border:{r:0,g:0,b:0}, fill:{r:100,g:100,b:200} }, Ellipse{ left:5,top:70,width:30, height:50, thickness:1, border:{r:0,g:0,b:0} }, Ellipse{ left:30,top:90,width:30, height:50, thickness:1, border:{r:0,g:0,b:0}, fill:{r:100,g:100,b:200} }, Text{ text:"Hello", x:5,y:180,font:"sans-serif",size:10 }, Polyline{ points:[ {x:40,y:10}, {x:50,y:20}, {x:60,y:10} ], thickness:4, color:{r:100,g:255,b:100} }, Polygon{ points:[ {x:5,y:220}, {x:35,y:220}, {x:20,y:250} ], thickness:2, border:{r:0,g:0,b:0}, fill:{r:200,g:200,b:255} }, Rect{ left:0,top:0,width:4,height:2, fill:{r:255, g:200,b:200} } ], sx:1.0, sy:2.0, tx:400, ty:500, rotate:45 }
Group{ contents:[ Line{x1:10,y1:20,x2:30, y2:40, thickness:3, color:{r:255,g:255,b:0} }, Rect{ left:5,top:10,width:30, height:50, thickness:1, border:{r:0,g:0,b:0} }, Rect{ left:30,top:30,width:30, height:50, thickness:1, border:{r:0,g:0,b:0}, fill:{r:100,g:100,b:200} }, Ellipse{ left:5,top:70,width:30, height:50, thickness:1, border:{r:0,g:0,b:0} }, Ellipse{ left:30,top:90,width:30, height:50, thickness:1, border:{r:0,g:0,b:0}, fill:{r:100,g:100,b:200} }, Text{ text:"Hello", x:5,y:180,font:"sans-serif",size:10 }, Polyline{ points:[ {x:40,y:10}, {x:50,y:20}, {x:60,y:10} ], thickness:4, color:{r:100,g:255,b:100} }, Polygon{ points:[ {x:5,y:220}, {x:35,y:220}, {x:20,y:250} ], thickness:2, border:{r:0,g:0,b:0}, fill:{r:200,g:200,b:255} }, Group{ contents:[ Rect{ left:0,top:0,width:40,height:20, fill:{r:255, g:200,b:200} } ], sx:0.5,sy:4.0, rotate:45 } ], sx:1.0, sy:2.0, tx:400, ty:500, rotate:45 }