Rob Camick wrote:This is your current code:
So the method would be:
And your painting code would be:
Sorry, I'm still struggling.
I randomly generate a new x, y and want to use those values in my drawing panel. (The 10 and 100 increments are trivial to the logic. They were there to position the ball image more accurately on the court.)
Here is how I've changed my button click
And this is the method I've added to the DrawingPanel class (empty because I'm not sure what to put in it)
Unfortunately, I am now getting a compile error of "cannot find symbol - method moveBall(int, int)" on the line "drawing_panel.moveBall(xPos,yPos);" - which I don't understand at all. I thought I had created a DrawingPanel object called drawing_panel. Additionally I'm not sure what code goes into my moveBall method in DrawingPanel.
I appreciate your time and patience. Java is gradually seeping in to me but it's slow going.