Graphics g = panel.getGraphics();
Graphics g = panel.getGraphics(); // so you can use graphics.
Make sure to use: import java.util.*; Then: Graphics g = panel.getGraphics();
Graphics g = panel.getGraphics();, provided you imported java.util.*;
import java.util.*;