I do not understand how to draw/paint on components. For example i want to draw something on a Jpanel. How to pass the reference to the paint method to draw on that specific component. In all the books (Graphics g) argument is passed but this g does not give reference to the paint method as on which component it is painting.