• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Box类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


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


示例17: buildAxes

import javafx.scene.shape.Box; //导入依赖的package包/类
private void buildAxes() {
    double length = 2d * dimModel;
    double width = dimModel / 100d;
    double radius = 2d * dimModel / 100d;
    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);
    
    Sphere xSphere = new Sphere(radius);
    Sphere ySphere = new Sphere(radius);
    Sphere zSphere = new Sphere(radius);
    xSphere.setMaterial(redMaterial);
    ySphere.setMaterial(greenMaterial);
    zSphere.setMaterial(blueMaterial);
    
    xSphere.setTranslateX(dimModel);
    ySphere.setTranslateY(dimModel);
    zSphere.setTranslateZ(dimModel);
    
    Box xAxis = new Box(length, width, width);
    Box yAxis = new Box(width, length, width);
    Box zAxis = new Box(width, width, length);
    xAxis.setMaterial(redMaterial);
    yAxis.setMaterial(greenMaterial);
    zAxis.setMaterial(blueMaterial);
    
    autoScalingGroup.getChildren().addAll(xAxis, yAxis, zAxis);
    autoScalingGroup.getChildren().addAll(xSphere, ySphere, zSphere);
}
 
开发者ID:gluonhq,项目名称:gluon-samples,代码行数:36,代码来源:ContentModel.java


示例18: getAxes

import javafx.scene.shape.Box; //导入依赖的package包/类
/**
 * Gets the three axes displayed by the gizmo.
 * 
 * @return An ArrayList containing the three Box shapes used to represent
 *         the axes, in the order x, y, z.
 */
public ArrayList<Box> getAxes() {
	ArrayList<Box> axes = new ArrayList<Box>();

	axes.add(axisX);
	axes.add(axisY);
	axes.add(axisZ);

	return axes;
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:16,代码来源:TestGizmo.java


示例19: setupSceneInternals

import javafx.scene.shape.Box; //导入依赖的package包/类
/**
 * <p>
 * Creates scene elements that aren't meant to be manipulated by the user
 * (markers, camera, etc.)
 * </p>
 */
protected void setupSceneInternals(Group parent) {
	// Create scene plane for frame of reference.
	Box box = new Box(1000, 0, 1000);
	box.setMouseTransparent(true);
	box.setDrawMode(DrawMode.LINE);
	box.setMaterial(new PhongMaterial(Color.ANTIQUEWHITE));

	AmbientLight ambientLight = new AmbientLight(Color.rgb(100, 100, 100));

	PointLight light1 = new PointLight(Color.ANTIQUEWHITE);
	light1.setMouseTransparent(true);
	light1.setTranslateY(-350);

	PointLight light2 = new PointLight(Color.ANTIQUEWHITE);
	light2.setMouseTransparent(true);
	light2.setTranslateZ(350);

	PointLight light3 = new PointLight(Color.ANTIQUEWHITE);
	light3.setMouseTransparent(true);
	light3.setTranslateZ(-350);

	PointLight light4 = new PointLight(Color.ANTIQUEWHITE);
	light4.setMouseTransparent(true);
	light4.setTranslateZ(350);

	TransformGizmo gizmo = new TransformGizmo(1000);
	gizmo.showHandles(false);

	parent.getChildren().addAll(gizmo, box, light1, light2, light3, light4,
			ambientLight);

}
 
开发者ID:eclipse,项目名称:eavp,代码行数:39,代码来源:FXViewer.java


示例20: setupSceneInternals

import javafx.scene.shape.Box; //导入依赖的package包/类
@Override
protected void setupSceneInternals(Group parent) {
	// Create scene plane for frame of reference.
	plane = new Box(1000, 0, 1000);
	plane.setMouseTransparent(true);
	plane.setDrawMode(DrawMode.LINE);
	plane.setMaterial(new PhongMaterial(Color.ANTIQUEWHITE));

	AmbientLight ambientLight = new AmbientLight(Color.rgb(100, 100, 100));

	PointLight light1 = new PointLight(Color.ANTIQUEWHITE);
	light1.setMouseTransparent(true);
	light1.setTranslateY(-350);

	PointLight light2 = new PointLight(Color.ANTIQUEWHITE);
	light2.setMouseTransparent(true);
	light2.setTranslateZ(350);

	PointLight light3 = new PointLight(Color.ANTIQUEWHITE);
	light3.setMouseTransparent(true);
	light3.setTranslateZ(-350);

	PointLight light4 = new PointLight(Color.ANTIQUEWHITE);
	light4.setMouseTransparent(true);
	light4.setTranslateZ(350);

	axes = new TransformGizmo(1000);
	axes.showHandles(false);

	parent.getChildren().addAll(axes, plane, light1, light2, light3, light4,
			ambientLight);

}
 
开发者ID:eclipse,项目名称:eavp,代码行数:34,代码来源:FXGeometryViewer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BlockCanary类代码示例发布时间:2022-05-21
下一篇:
Java DistributionPointName类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap