/
App.java
44 lines (34 loc) · 1.02 KB
/
App.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package de.ruzman.hand;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.Sphere;
import javafx.stage.Stage;
public class App extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
Group group = new Group();
Scene scene = new Scene(group, 500, 500);
PerspectiveCamera camera = new PerspectiveCamera(true);
camera.setTranslateZ(-10);
scene.setCamera(camera);
group.getChildren().add(create3DBall());
primaryStage.setScene(scene);
primaryStage.show();
}
private Node create3DBall() {
Sphere sphere = new Sphere();
PhongMaterial material = new PhongMaterial();
material.setSpecularColor(Color.GREEN);
material.setDiffuseColor(Color.DARKGREEN);
sphere.setMaterial(material);
return sphere;
}
}