Note, also, that if you draw on something this way, then as soon as the screen needs updating (other window obscures the app, window resized, etc) then you'll be left with an ugly blank area. It's only by overriding paint() that you enable
Java to repaint the window as needed. Why not explain to us exactly what you're trying to achieve, and we can offer some advice on how to do it.