import java.awt.*; import java.awt.geom.*; import javax.swing.*; public class Canvas extends JPanel { // This is the draw callback public void paintComponent (Graphics g) { //*1 Right way, draw in the callback super.paintComponent(g); //*3 Supposed to chain to superclass, which clears background first g.drawLine (50, 50, 100, 50); //*2 Draw on the "g" object } }