本文整理汇总了Java中javafx.scene.shape.Box.setLayoutY方法的典型用法代码示例。如果您正苦于以下问题:Java Box.setLayoutY方法的具体用法?Java Box.setLayoutY怎么用?Java Box.setLayoutY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Box
的用法示例。
在下文中一共展示了Box.setLayoutY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import javafx.scene.shape.Box; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
final PhongMaterial red = new PhongMaterial(Color.RED);
final PhongMaterial green = new PhongMaterial(Color.GREEN);
final PhongMaterial blue = new PhongMaterial(Color.BLUE);
final Box cube = new Box(200, 200, 200);
cube.setLayoutX(150);
cube.setLayoutY(800);
cube.setDrawMode(DrawMode.LINE);
cube.setMaterial(red);
final Cylinder cylinder = new Cylinder(150, 50);
cylinder.setLayoutX(500);
cylinder.setLayoutY(800);
cylinder.setDrawMode(DrawMode.LINE);
cylinder.setMaterial(green);
final Sphere sphere = new Sphere(100);
sphere.setLayoutX(850);
sphere.setLayoutY(800);
sphere.setDrawMode(DrawMode.LINE);
sphere.setMaterial(blue);
final AmbientLight light = new AmbientLight(Color.WHITE);
final Pane root = new Pane();
root.setStyle("-fx-background-color: transparent;");
root.getChildren().addAll(cube, cylinder, sphere, light);
final int[] tesselations = {1, 5, 10, 50, 100};
for (int index = 0; index < tesselations.length; index++) {
final int dx = 1000 / tesselations.length;
final int tesselation = tesselations[index];
final Sphere tesselatedSphere = new Sphere(75, tesselation);
tesselatedSphere.setDrawMode(DrawMode.LINE);
root.getChildren().add(tesselatedSphere);
tesselatedSphere.setTranslateX(100 + dx * index);
tesselatedSphere.setTranslateY(400);
final Cylinder tesselatedCylinder = new Cylinder(75, 50, tesselation);
tesselatedCylinder.setDrawMode(DrawMode.LINE);
root.getChildren().add(tesselatedCylinder);
tesselatedCylinder.setTranslateX(100 + dx * index);
tesselatedCylinder.setTranslateY(100);
}
final Scene scene = new Scene(root, 1000, 1000);
scene.setFill(Color.BLACK);
scene.setCamera(new PerspectiveCamera());
primaryStage.setScene(scene);
primaryStage.setTitle("Test_Triangle");
primaryStage.show();
}