Often we required some shapes which are not in the list of Basic Shapes available in JavaFX. I mean this is true with any language. A month back, I wanted to make a tube in JavaFX and Tube has very awesome cut at the top which can't be done with basic shapes. We can easily tackle these conditions by intersecting and subtracting the shapes. Have a look :
Now, this is very easy to make. 1 subtraction and that's it. This is just 2 ellipses and 1 Shape subtraction ! Find the code :
Even in this, we can play more and make it as real as it is desired. If you see my tube closely, you will find a green color on the top which gives a feeling that the inside color or liquid inside the tube is green in color. Rotating this tube with 90 and removing the lower base can be helped in the simulation of Pipes. With this only, I had written one small code, showing how light travel in pipes. I will post that code as well in few days.
If you are interest in seeing the liquid filling in this tube, please visit this article.