Declare "box" as a member variable and use
setLocation to move/position it in the
paint method.
int appletsize_x = 300;
int appletsize_y = 300;
Rectangle box = new Rectangle(60, 25);
Graphics2D g2 = (Graphics2D) g;
box.setLocation(x_pos,y_pos);
g2.draw(box);
Then when it is time for collision–checking in your ball Runnable you can get access to the box as an obstacle with
int minX = box.x;
int maxX = box.x + box.width;
int maxY = box.y + box.height;