You don't mix creating components with drawing, and in fact your drawing code should be lean, mean, and blindingly fast and not have to worry itself with program logic or component creation or removal. Usually we use passive graphics where we do our drawing in a JComponent's (or JComponent-derived component's) paintComponent(...) method. You appear to be trying to use "active" rendering which has issues of its own. Are you sure that this is the route you wish to take? Are you following a tutorial that is directing you to take this route?