what is the problem ?
you create a method that gets an int value and paints the shape again :

Code:
public void repaint(int x){
  size=x;
  paintMethod();
}


and you shouldnt make the size variable public as it is not something for everyone to use and see at will .