package net.havercan.geometry3D; import javafx.application.*; import javafx.stage.Stage; import javafx.scene.*; import javafx.scene.paint.PhongMaterial; import javafx.scene.paint.Color; import javafx.scene.shape.Sphere; public class ShowSphere extends Application {@Override public void start(Stage stage) {Group root = new Group(); Group camGroup = new Group(); Group draw = new Group(); Scene scene = new Scene(root, 600, 400); Camera camera = new ParallelCamera(); AmbientLight ambient = new AmbientLight(Color.rgb(96,96,96)); PointLight spotlight = new PointLight(Color.WHITE); PhongMaterial blue_mat = new PhongMaterial(); Sphere blue_sph = new Sphere(128.0); double sphere_x = 300.0; double sphere_y = 200.0; blue_mat.setDiffuseColor (Color.BLUE); blue_mat.setSpecularColor (Color.LIGHTBLUE); blue_sph.setMaterial (blue_mat); blue_sph.setLayoutX (sphere_x); blue_sph.setLayoutY (sphere_y); spotlight.setLayoutX(700); spotlight.setLayoutY(-2000); spotlight.setTranslateZ(-1000); camGroup.getChildren().add(camera); draw.getChildren().add(blue_sph); root.getChildren().add(camGroup); root.getChildren().add(ambient); root.getChildren().add(spotlight); root.getChildren().add(draw); scene.setCamera(camera); stage.setScene(scene); stage.setTitle("JavaFX 3D Sphere demonstration"); stage.show(); } public static void main(String[] args) {if (Platform.isSupported(ConditionalFeature.SCENE3D)) launch(args); else System.out.println("JavaFX 3D support is not available. Application is terminating");} }