I have a JPanel in which I draw triangles via the method drawPolygon. My Goal is to rotate the graphics around the X axis. I know that there is a method called rotate, but this method rotates only around the Z axis.
How can I rotate a graphic in a JPanel around the X axis?

If the Graphics 2D library does not have the functionality to do this kind of rotation, please tell me how can I archive my goal otherwise. I don't mind switching to another GUI type like Java-fx or canvas. (But stay in Java)