Check out example codes for "java fx display simple rectangle". It will help you in understanding the concepts better.

Code Example 1

setX(value); 
setY(value); 
setWidth(value); 
setHeight(value);

Code Example 2

Rectangle rectangle = new Rectangle(x, y, width, height);

Learn ReactJs, React Native from akashmittal.com