I have a JComponent subclass that I am using to draw shapes onto my screen. In the constructor, I am trying to set ballX and ballY to half
JComponent
ballX
ballY
I agree with trashgod's answer. (+1)
Move the ballX and ballY in the paintComponent(g) like this
paintComponent(g)
if (ballX==0 && ballY==0) { ballX = getWidth()/2; ballY = getHeight()/2; }