javafx.scene.shape.Cylinder Java Examples

The following examples show how to use javafx.scene.shape.Cylinder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Histogram.java    From FXyzLib with GNU General Public License v3.0 5 votes vote down vote up
private Node createDefaultNode(double barWidth, double barHeight) {
    switch (defaultNodeType) {
        case CYLINDER:
            return new Cylinder(barWidth / 2, barHeight);
        case CUBE:
            return new Box(barWidth, barHeight, barWidth);
        default:
            return new Box(barWidth, barHeight, barWidth);
    }
}
 
Example #2
Source File: MqttListener.java    From diozero with MIT License 4 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
	primaryStage.setResizable(false);
	Scene scene = new Scene(root, 1024, 800, true);
	
	// Create and position camera
	Camera camera = new PerspectiveCamera();
	camera.getTransforms().addAll(
			new Rotate(0, Rotate.Y_AXIS),
			new Rotate(0, Rotate.X_AXIS),
			new Translate(-500, -425, 1200));
	scene.setCamera(camera);
	scene.setFill(Paint.valueOf(Color.BLACK.toString()));
	
	// Box
	testObject = new Cylinder(10, 50);
	testObject.setMaterial(new PhongMaterial(Color.RED));
	testObject.getTransforms().addAll(new Translate(50, 0, 0));
	
	TdsModelImporter model_importer = new TdsModelImporter();
	model_importer.read(getClass().getResource("/models/SpaceLaunchSystem.3DS"));
	Node[] nodes = model_importer.getImport();
	model_importer.close();
	Group rocket = new Group(nodes);
	rocket.getTransforms().addAll(new Translate(0, 25, 0));

	// Build the Scene Graph
	root.getChildren().addAll(testObject, rocket);

	primaryStage.setScene(scene);
	primaryStage.show();
	
	primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
		@Override
		public void handle(WindowEvent event) {
			System.out.println(event);
			if (event.getEventType().equals(WindowEvent.WINDOW_CLOSE_REQUEST)) {
				System.exit(0);
			}
		}
	});
	
	mqttClient.subscribe(MQTT_TOPIC_IMU + "/#");
}