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


Java Box类代码示例

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


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

示例1: AxisOrientation

import javafx.scene.shape.Box; //导入依赖的package包/类
public AxisOrientation(int size) {
    final PhongMaterial redMaterial = new PhongMaterial();
    redMaterial.setDiffuseColor(Color.DARKRED);
    redMaterial.setSpecularColor(Color.RED);

    final PhongMaterial greenMaterial = new PhongMaterial();
    greenMaterial.setDiffuseColor(Color.DARKGREEN);
    greenMaterial.setSpecularColor(Color.GREEN);

    final PhongMaterial blueMaterial = new PhongMaterial();
    blueMaterial.setDiffuseColor(Color.DARKBLUE);
    blueMaterial.setSpecularColor(Color.BLUE);
    final Box xAxis = new Box(size + 100, 2, 2);
    final Box yAxis = new Box(2, size + 100, 2);
    final Box zAxis = new Box(2, 2, size + 100);

    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);

    this.getChildren().addAll(xAxis, yAxis, zAxis);
}
 
开发者ID:adihubba,项目名称:javafx-3d-surface-chart,代码行数:23,代码来源:AxisOrientation.java

示例2: Face

import javafx.scene.shape.Box; //导入依赖的package包/类
public Face(Image image, int startX, int startY, int width, int height, int interval, boolean reverseX, boolean reverseY,
		Supplier<Box> supplier, BiConsumer<Box, Point2D> consumer) {
	PixelReader reader = image.getPixelReader();
	for (int x = 0; x < width; x++)
		for (int y = 0; y < height; y++) {
			int argb;
			if ((argb = reader.getArgb(startX + (reverseX ? width - x - 1 : x) * interval,
					startY + (reverseY ? height - y - 1 : y) * interval)) != 0) {
				Box pixel = supplier.get();
				consumer.accept(pixel, new Point2D(x, y));
				pixel.setMaterial(createMaterial(Color.rgb(
						(argb >> 16) & 0xFF, (argb >> 8) & 0xFF, (argb >> 0) & 0xFF)));
				getChildren().add(pixel);
			}
		}
}
 
开发者ID:InfinityStudio,项目名称:minecraft-jfx-skin,代码行数:17,代码来源:SkinMultipleCubes.java

示例3: initKeys

import javafx.scene.shape.Box; //导入依赖的package包/类
@Override
protected void initKeys(Scene scene) {
    scene.addEventHandler(KeyEvent.ANY, new EventHandler<KeyEvent>() {
        @Override
        public void handle(KeyEvent t) {
            switch (t.getText()) {
                case "1":
                    setShape(Shape.Sphere);
                    break;
                case "2":
                    setShape(Shape.Box);
                    break;
                case "3":
                    setShape(Shape.Cylinder);
                    break;
            }
        }
    });
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:20,代码来源:ShapesPickingAbstractApp.java

示例4: 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

示例5: 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

示例6: buildAxes

import javafx.scene.shape.Box; //导入依赖的package包/类
private Group buildAxes(Pivot p, double _l) {
	Group group = new Group();

	final Box xAxis = new Box(_l, 4, 4);
	final Box yAxis = new Box(4, _l, 4);
	final Box zAxis = new Box(4, 4, _l);

	xAxis.setMaterial(PhongPhactory.fromColour(Color.RED));
	yAxis.setMaterial(PhongPhactory.fromColour(Color.GREEN));
	zAxis.setMaterial(PhongPhactory.fromColour(Color.BLUE));

	p.getChildren().addAll(xAxis, yAxis, zAxis);
	p.setVisible(true);
	group.getChildren().addAll(p);

	return group;
}
 
开发者ID:sanke69,项目名称:fr.xs.jtk,代码行数:18,代码来源:SolarSystemTest.java

示例7: 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

示例8: buildAxes

import javafx.scene.shape.Box; //导入依赖的package包/类
private void buildAxes() {
	final PhongMaterial redMaterial = new PhongMaterial();
	redMaterial.setDiffuseColor(Color.DARKRED);
	redMaterial.setSpecularColor(Color.RED);
	
	final PhongMaterial greenMaterial = new PhongMaterial();
	greenMaterial.setDiffuseColor(Color.DARKGREEN);
	greenMaterial.setSpecularColor(Color.GREEN);
	
	final PhongMaterial blueMaterial = new PhongMaterial();
	blueMaterial.setDiffuseColor(Color.DARKBLUE);
	blueMaterial.setSpecularColor(Color.BLUE);
	
	final Box xAxis = new Box(240.0, 1, 1);
	final Box yAxis = new Box(1, 240.0, 1);
	final Box zAxis = new Box(1, 1, 240.0);
	
	xAxis.setMaterial(redMaterial);
	yAxis.setMaterial(greenMaterial);
	zAxis.setMaterial(blueMaterial);
	
	axisGroup.getChildren().addAll(xAxis, yAxis, zAxis);
	world.getChildren().addAll(axisGroup);
}
 
开发者ID:Jenna3715,项目名称:3D-Game,代码行数:25,代码来源:MoleculeSampleApp.java

示例9: makePedestal

import javafx.scene.shape.Box; //导入依赖的package包/类
private void makePedestal(ObservableList<Node> g) {
	// pedestal
	Box box = new Box(5.5, 0.2, 5);
	box.setMaterial(material2);
	// box.setTranslateY(3);

	double length1 = 4.2;
	// outlet dispatch tube
	Capsule t1 = new Capsule(0.3, length1);
	t1.setCullFace(CullFace.BACK);
	t1.setMaterial(material);
	t1.getTransforms().addAll(new Rotate(90, X_AXIS), new Translate(0, -length1 / 2, -0.4));

	double length2 = 4.4;
	// outlet endpoint supply tube
	Group tg = makePump(length2, 0.3, 0.35, material);
	tg.getTransforms().addAll(new Rotate(90, X_AXIS), new Translate(-2.8, 0, -1.5));

	g.addAll(t1, tg, box);

	// TriangleMesh mesh = createToroidMesh(2f, 0.5f, 100, 100);
	// g.addAll(new MeshView(mesh));
}
 
开发者ID:lyrachord,项目名称:FX3DAndroid,代码行数:24,代码来源:ScadaApplication.java

示例10: Bone

import javafx.scene.shape.Box; //导入依赖的package包/类
public Bone(double scale, Point3D posJoint) {
    Box origin=new Box(10,10,10);
    origin.setMaterial(new PhongMaterial(Color.ORANGE));
    
    Cylinder bone = new Cylinder(5, posJoint.magnitude()/scale);
    double angle = Math.toDegrees(Math.acos((new Point3D(0,1,0)).dotProduct(posJoint)/posJoint.magnitude()));
    Point3D axis = (new Point3D(0,1,0)).crossProduct(posJoint);
    bone.getTransforms().addAll(new Rotate(angle,0,0,0,axis), new Translate(0,posJoint.magnitude()/2d/scale, 0));
    bone.setMaterial(new PhongMaterial(Color.CADETBLUE));
    
    Sphere end = new Sphere(6);
    end.getTransforms().addAll(new Translate(posJoint.getX()/scale,posJoint.getY()/scale,posJoint.getZ()/scale));
    end.setMaterial(new PhongMaterial(Color.YELLOW));
    
    getChildren().addAll(origin, bone, end);
    getTransforms().add(new Scale(scale, scale, scale));
}
 
开发者ID:jperedadnr,项目名称:RiggedHand,代码行数:18,代码来源:Bone.java

示例11: 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

示例12: buildGroup

import javafx.scene.shape.Box; //导入依赖的package包/类
private static Group buildGroup() {
        Group grp = new Group();
        Sphere s = new Sphere();
        Box b = new Box();
        s.setScaleX(SCALE);
        s.setScaleY(SCALE);
        s.setScaleZ(SCALE);
        s.setTranslateX(-130);
        b.setScaleX(SCALE);
        b.setScaleY(SCALE);
        b.setScaleZ(SCALE);
        b.setTranslateX(130);
        PhongMaterial material = new PhongMaterial();
        material.setDiffuseColor(Color.LIGHTGRAY);
        material.setSpecularColor(Color.rgb(30, 30, 30));
        s.setMaterial(material);
        b.setMaterial(material);
        PointLight pl = new PointLight(Color.AQUA);
        pl.setTranslateZ(-1000);
        Sphere lightBalance = new Sphere();
//        lightBalance.setScaleX(0.1);
//        lightBalance.setScaleX(0.1);
//        lightBalance.setScaleX(0.1);
        lightBalance.setTranslateZ(1000);
        grp.getChildren().addAll(s, b,pl,lightBalance);
        return grp;
    }
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:28,代码来源:SubSceneDepthTestApp.java

示例13: getShapes

import javafx.scene.shape.Box; //导入依赖的package包/类
@Override
protected Shape3D[] getShapes() {
    Shape3D[] result = {
        new Box(2, 2, 2),
        new Box(2, 2, 2)
    };
    result[1].setTranslateX(1.5);
    result[0].setTranslateX(-1.5);
    return result;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:11,代码来源:DepthTestApp.java

示例14: getShapes

import javafx.scene.shape.Box; //导入依赖的package包/类
@Override
protected Shape3D[] getShapes() {
    Shape3D[] result = {
        new Box(4, 4, 1),
        new Box(2, 2, 2)
    };
    result[0].setRotationAxis(Rotate.Y_AXIS);
    result[0].setRotate(45);
    result[1].setRotationAxis(Rotate.X_AXIS);
    result[1].setRotate(45);

    return result;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:14,代码来源:IntersectionTestApp.java

示例15: initTestCase

import javafx.scene.shape.Box; //导入依赖的package包/类
public void initTestCase(TestCaseType type) {
    if (isThereTestCase) {
        root.getChildren().clear();
        nodes.clear();
        lights.clear();
        movers.clear();
    }
    switch (type) {
        case SINGLE_SPHERE_CASE:
            root.getChildren().add(buildSingle(new Sphere(50)));
            break;
        case SINGLE_BOX_CASE:
            root.getChildren().add(buildSingle(new Box(100, 100, 100)));
            break;
        case SINGLE_CYLINDER_CASE:
            root.getChildren().add(buildSingle(new Cylinder(50, 100)));
            break;
        case SINGLE_MESH_CASE:
            Cone cone = new Cone(50, 100);
            root.getChildren().add(buildSingle(cone.getMesh()));
            break;
        case MULTIPLE_SHAPE3D_CASE:
            root.getChildren().add(buildMultipleShapes3D());
            break;
        case MULTIPLE_SHAPE_CASE:
            root.getChildren().add(buildMultipleShapes());
            break;
    }
    isThereTestCase = true;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:31,代码来源:LightScopeTestApp.java


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