How do I do simple graphics when I press a button?

I'm new to graphics and I want to draw on a JPanel when the user presses a button (or something else under program control).

I tried

privatevoid DrawPoints(){

int x, y;

x=10;

y=10;

final Graphics g = jPanel.getGraphics();

g.fillOval(x-2, y-2, 4, 4);

}

The debugger tells me that This element neither has attached source nor attached Javadoc and hence no information could be found for the getGraphics.

I want to tell it: OK, the purpose of this jPanel is to draw graphics. How do I tell it, or convince it to let me draw on the panel?

Thanks,

Ilan

[813 byte] By [Ilana] at [2007-11-26 15:08:38]
# 1
Did you see the painting in Swing tutorial? http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html
PhHeina at 2007-7-8 8:59:04 > top of Java-index,Java Essentials,New To Java...