当前位置: 首页>>代码示例>>Java>>正文


Java Box.setTranslateY方法代码示例

本文整理汇总了Java中javafx.scene.shape.Box.setTranslateY方法的典型用法代码示例。如果您正苦于以下问题:Java Box.setTranslateY方法的具体用法?Java Box.setTranslateY怎么用?Java Box.setTranslateY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.shape.Box的用法示例。


在下文中一共展示了Box.setTranslateY方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildMultipleShapes3D

import javafx.scene.shape.Box; //导入方法依赖的package包/类
private Group buildMultipleShapes3D() {
    Box box = new Box(100, 100, 100);
    Sphere sphere = new Sphere(50);
    Cylinder cyl = new Cylinder(50, 100);
    Cone cone = new Cone(50, 100);
    box.setTranslateX(-100);
    box.setTranslateY(-150);

    sphere.setTranslateX(100);
    sphere.setTranslateY(-50);

    cyl.setTranslateX(-100);
    cyl.setTranslateY(50);

    cone.getMesh().setTranslateX(100);
    cone.getMesh().setTranslateY(150);

    nodes.add(box);
    nodes.add(sphere);
    nodes.add(cyl);
    nodes.add(cone.getMesh());
    return new Group(box, sphere, cyl, cone.getMesh());
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:24,代码来源:LightScopeTestApp.java

示例2: buildCubes

import javafx.scene.shape.Box; //导入方法依赖的package包/类
private void buildCubes(ActionEvent event) {
    world = new XForm();
    moleculeGroup = new XForm();
    for (Cube cube : cubes) {

        Box boxShape = new Box(cube.getSideLength(), cube.getSideLength(), cube.getSideLength());
        boxShape.setMaterial(MaterialProvider.crateMaterialFromColor(Color.LIGHTSALMON));
        boxShape.setTranslateX(cube.getCenter().getX());
        boxShape.setTranslateY(cube.getCenter().getY());
        boxShape.setTranslateZ(cube.getCenter().getZ());

        // add tooltip
        Tooltip tooltip = new Tooltip(cube.toString());
        Tooltip.install(boxShape, tooltip);

        moleculeGroup.getChildren().add(boxShape);
    }
    world.getChildren().add(moleculeGroup);
    displayGroup.getChildren().retainAll();
    displayGroup.getChildren().add(world);
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:22,代码来源:StructureViewer.java

示例3: createPlane

import javafx.scene.shape.Box; //导入方法依赖的package包/类
private void createPlane(double length) {
    Box xzPlane = new Box(length, PLANE_THICKNESS, length);
    xzPlane.setDrawMode(DrawMode.LINE);
    xzPlane.setTranslateX(length / 2.0);
    xzPlane.setTranslateZ(length / 2.0);
    
    Box xyPlane = new Box(length, length, PLANE_THICKNESS);
    xyPlane.setDrawMode(DrawMode.LINE);
    xyPlane.setTranslateX(length / 2.0);
    xyPlane.setTranslateY(length / 2.0);
    
    Box yzPlane = new Box(PLANE_THICKNESS, length, length);
    yzPlane.setDrawMode(DrawMode.LINE);
    yzPlane.setTranslateY(length / 2.0);
    yzPlane.setTranslateZ(length / 2.0);
    
    this.group.getChildren().addAll(xzPlane, xyPlane, yzPlane);
}
 
开发者ID:opengl-8080,项目名称:classical-physics,代码行数:19,代码来源:Axis.java

示例4: start

import javafx.scene.shape.Box; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
	Box floor = new Box(1000, 10, 1000);
	floor.setTranslateY(150);
	root.getChildren().add(floor);

	Sphere s = new Sphere(150);
	s.setTranslateX(5);
	s.setPickOnBounds(true);
	root.getChildren().add(s);

	showStage(stage);
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:14,代码来源:Drag3DObject.java

示例5: buildMultipleShapes

import javafx.scene.shape.Box; //导入方法依赖的package包/类
private Group buildMultipleShapes() {
    Box box = new Box(100, 100, 100);
    Sphere sphere = new Sphere(50);
    Cylinder cyl = new Cylinder(50, 100);
    Cone cone = new Cone(50, 100);
    Rectangle rect = new Rectangle(50, 50);
    rect.setFill(Color.WHITESMOKE);
    box.setTranslateX(-100);
    box.setTranslateY(-150);

    sphere.setTranslateX(100);
    sphere.setTranslateY(-50);

    cyl.setTranslateX(-100);
    cyl.setTranslateY(50);

    cone.getMesh().setTranslateX(100);
    cone.getMesh().setTranslateY(150);

    rect.setTranslateX(-25);
    rect.setTranslateY(-25);
    rect.setRotationAxis(Rotate.Y_AXIS);
    rect.setRotate(45);

    nodes.add(box);
    nodes.add(sphere);
    nodes.add(cyl);
    nodes.add(cone.getMesh());
    nodes.add(rect);

    return new Group(box, sphere, cyl, cone.getMesh(), rect);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:33,代码来源:LightScopeTestApp.java

示例6: start

import javafx.scene.shape.Box; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
    Box floor = new Box(1000, 10, 1000);
    floor.setTranslateY(150);
    root.getChildren().add(floor);

    Sphere s = new Sphere(150);
    s.setTranslateX(5);
    s.setPickOnBounds(true);
    root.getChildren().add(s);
    
    showStage(stage);
}
 
开发者ID:FXyz,项目名称:FXyzLib,代码行数:14,代码来源:Drag3DObject.java

示例7: createAxis

import javafx.scene.shape.Box; //导入方法依赖的package包/类
private void createAxis(double length) {
    Box x = new Box(length, AXIS_THICKNESS, AXIS_THICKNESS);
    x.setMaterial(new PhongMaterial(Color.BLUE));
    x.setTranslateX(length / 2.0);
    
    Box y = new Box(AXIS_THICKNESS, length, AXIS_THICKNESS);
    y.setMaterial(new PhongMaterial(Color.RED));
    y.setTranslateY(length / 2.0);
    
    Box z = new Box(AXIS_THICKNESS, AXIS_THICKNESS, length);
    z.setMaterial(new PhongMaterial(Color.GREEN));
    z.setTranslateZ(length / 2.0);
    
    this.group.getChildren().addAll(x, y, z);
}
 
开发者ID:opengl-8080,项目名称:classical-physics,代码行数:16,代码来源:Axis.java

示例8: AxesGrid

import javafx.scene.shape.Box; //导入方法依赖的package包/类
/**
 * Construct a new axes and grid in 3D.
 *
 * @param length length of the axis and grid
 */
public AxesGrid(double length) {
  redMaterial.setDiffuseColor(Color.RED);
  redMaterial.setSpecularColor(Color.PINK);

  greenMaterial.setDiffuseColor(Color.GREEN);
  greenMaterial.setSpecularColor(Color.LIGHTGREEN);

  blueMaterial.setDiffuseColor(Color.BLUE);
  blueMaterial.setSpecularColor(Color.LIGHTBLUE);

  blackMaterial.setDiffuseColor(Color.BLACK);
  blackMaterial.setSpecularColor(Color.BLACK);

  final Box xAxis = new Box(length, AXES_THICKNESS, AXES_THICKNESS);
  xAxis.setTranslateX(length / 2.0);
  xAxis.setMaterial(redMaterial);

  final Box yAxis = new Box(AXES_THICKNESS, length, AXES_THICKNESS);
  yAxis.setTranslateY(length / 2.0);
  yAxis.setMaterial(greenMaterial);

  final Box zAxis = new Box(AXES_THICKNESS, AXES_THICKNESS, length);
  zAxis.setTranslateZ(length / 2.0);
  zAxis.setMaterial(blueMaterial);

  this.getChildren().addAll(xAxis, yAxis, zAxis);

  for (int i = (int) -length; i <= length; i++) {
    addXLine(length * 2, i);
  }
  for (int i = (int) -length; i <= length; i++) {
    addYLine(length * 2, i);
  }
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:40,代码来源:AxesGrid.java

示例9: TransformGizmo

import javafx.scene.shape.Box; //导入方法依赖的package包/类
/**
 *
 * @param axisSize
 */
public TransformGizmo(double axisSize) {
	super();

	if (axisSize > 0) {
		
		this.axisSize = axisSize;
		
		axisXMaterial = new PhongMaterial();
		axisXMaterial.setDiffuseColor(Color.RED);

		axisYMaterial = new PhongMaterial();
		axisYMaterial.setDiffuseColor(Color.GREEN);

		axisZMaterial = new PhongMaterial();
		axisZMaterial.setDiffuseColor(Color.BLUE);

		PhongMaterial handleMaterial = new PhongMaterial();
		handleMaterial.setDiffuseColor(Color.BLUE);

		setDepthTest(DepthTest.DISABLE);
		
		createAxes(axisSize, axisWidth);

		handleX = new Box(15, 15, 15);
		handleX.setDepthTest(DepthTest.DISABLE);
		handleX.setMaterial(handleMaterial);
		handleX.setTranslateX(axisSize);
		handleX.setTranslateY(0);
		handleX.setTranslateZ(0);
		
		handleY = new Box(15, 15, 15);
		handleY.setDepthTest(DepthTest.DISABLE);
		handleY.setMaterial(handleMaterial);
		handleY.setTranslateX(0);
		handleY.setTranslateY(-axisSize);
		handleY.setTranslateZ(0);

		handleZ = new Box(15, 15, 15);
		handleZ.setDepthTest(DepthTest.DISABLE);
		handleZ.setMaterial(handleMaterial);
		handleZ.setTranslateX(0);
		handleZ.setTranslateY(0);
		handleZ.setTranslateZ(axisSize);

		ObservableList<Node> children = getChildren();

		children.add(handleX);
		children.add(handleY);
		children.add(handleZ);
		
		//The gizmo will initially be drawn on a 1 to 1 scale
		currentSize = 1;
	}
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:59,代码来源:TransformGizmo.java

示例10: createShape

import javafx.scene.shape.Box; //导入方法依赖的package包/类
protected Box createShape() {
	Box box =  new Box();
	box.setHeight(8);
	box.setTranslateY(4);
	return box;
}
 
开发者ID:canoo,项目名称:code-of-gotham,代码行数:7,代码来源:City.java

示例11: addXLine

import javafx.scene.shape.Box; //导入方法依赖的package包/类
/**
 * Add to the Group a narrow box that resembles a line in x-direction of the
 * given total length centered on the z-axis and offset by the given yOffset.
 *
 * @param length total length
 * @param yOffset position on y-axis
 */
private void addXLine(double length, double yOffset) {
  Box xline = new Box(length, GRID_THICKNESS, GRID_THICKNESS);
  xline.setMaterial(blackMaterial);
  xline.setTranslateY(yOffset);
  this.getChildren().add(xline);
}
 
开发者ID:billooms,项目名称:COrnLathe,代码行数:14,代码来源:AxesGrid.java


注:本文中的javafx.scene.shape.Box.setTranslateY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。