Since this is homework, I'm going to give you general guidance without code, but first and foremost, please read this link on performing custom painting with Swing. Next you should put the Window Builder software to the side and work on creating your own code from scratch, at least do this til you're comfortable coding with Swing.
Next suggestions:
- Have your DrawingPanel extend JPanel
- Override
paintComponent(Graphics g)
- Call the super's method in your override,
super.paintComponent(g)
as this will refresh the graphics and erase old "dirty" pixels. - Play with drawing lines using g.drawLine(...)`
- keep doing this and you'll get the idea of what you'll need.