import javafx.application.Application; import javafx.scene.AmbientLight; import javafx.scene.Group; import javafx.scene.PerspectiveCamera; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.paint.Material; import javafx.scene.paint.PhongMaterial; import javafx.scene.shape.Sphere; import javafx.stage.Stage; /* * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. */ /** * * @author Andrew Glushchenko */ public class AmbientLightTestApp extends Application { @Override public void start(Stage stage) throws Exception { PhongMaterial m = new PhongMaterial(); m.setDiffuseColor(Color.LIGHTGRAY); m.setSpecularColor(Color.rgb(30, 30, 30)); Sphere s = new Sphere(); s.setScaleX(100); s.setScaleY(100); s.setScaleZ(100); s.setMaterial(m); AmbientLight light = new AmbientLight(Color.AQUA); light.setTranslateZ(500); Group root = new Group(s, light); root.setTranslateX(250); root.setTranslateY(250); Scene scene = new Scene(root, 500, 500, true); scene.setCamera(new PerspectiveCamera()); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } }