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


Java CircleBuilder类代码示例

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


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

示例1: LocalTo_TransformsScene

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
public LocalTo_TransformsScene()
{
    super(hBox, 150, 150, true);
    setCamera(new PerspectiveCamera());

    StackPane firstPane = new StackPane();
    StackPane secondPane = new StackPane();
    StackPane thirdPane = new StackPane();
    StackPane nestedPane = new StackPane();
    StackPane doubleNestedPane = new StackPane();
    StackPane forthPane = new StackPane();

    Circle circle1 = CircleBuilder.create().radius(20).id("circle_one").build();
    Circle circle2 = CircleBuilder.create().radius(20).id("circle_two").build();
    Circle circle3 = CircleBuilder.create().radius(20).id("circle_three").build();
    Circle circle4 = CircleBuilder.create().radius(20).id("circle_four").translateZ(-50).build();

    forthPane.getChildren().add(circle4);
    doubleNestedPane.getChildren().add(circle3);
    nestedPane.getChildren().add(doubleNestedPane);
    thirdPane.getChildren().add(nestedPane);
    secondPane.getChildren().add(circle2);
    firstPane.getChildren().add(circle1);
    hBox.getChildren().addAll(firstPane, secondPane, thirdPane, forthPane);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:26,代码来源:LocalTo_TransformsApp.java

示例2: Bullet

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
/**
* The constructor for a bullet.
* 
* @param radius - the radius of the bullet
* @param fill - the color of the bullet highlight
*/
  public Bullet(double radius, Color fill) {
      sphere = CircleBuilder.create()
              .centerX(radius)
              .centerY(radius)
              .radius(radius)
              .cache(true)
              .build();
 
      RadialGradient rgrad = RadialGradientBuilder.create()
                  .centerX(sphere.getCenterX() - sphere.getRadius() / 3)
                  .centerY(sphere.getCenterY() - sphere.getRadius() / 3)
                  .radius(sphere.getRadius())
                  .proportional(false)
                  .stops(new Stop(0.0, fill), new Stop(1.0, Settings.BULLET_PRIMARY_COLOR))
                  .build();
 
      sphere.setFill(rgrad);
  }
 
开发者ID:adisrini,项目名称:enders_game,代码行数:25,代码来源:Bullet.java

示例3: createMinus

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
private void createMinus() {
	Path minus = PathBuilder.create()
			.elements(new MoveTo(0, 0),
					new LineTo(0, 5),
					new LineTo(15, 5),
					new LineTo(15, 0),
					new LineTo(0, 0))
			.stroke(Color.web("#000000"))
			.fill(Color.web("#FFFFFF"))
			.strokeWidth(1)
			.cursor(Cursor.HAND)
			.build();
	Circle c = CircleBuilder.create().radius(13).style("-fx-fill:-fx-base;").build() ;
	StackPane sp = StackPaneBuilder.create().styleClass("close-btn")
								   .maxHeight(26).maxWidth(26)
								   .prefHeight(26).prefWidth(26)
								   .children(c,minus).build();
	
	root.getChildren().add(sp);
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:21,代码来源:ShapesDemo.java

示例4: createBubbleCircle

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
private Circle createBubbleCircle(double radius) {
    CircleBuilder<?> circleBuilder = CircleBuilder.create();
    circleBuilder.radius(radius);
    circleBuilder.cache(true);
    Circle sphere = circleBuilder.build();
    sphere.setOpacity(BUBBLE_OPACITY);

    RadialGradientBuilder gradientBuilder = RadialGradientBuilder.create();
    gradientBuilder.centerX(sphere.getCenterX() - sphere.getRadius() / 3);
    gradientBuilder.centerY(sphere.getCenterY() - sphere.getRadius() / 3);
    gradientBuilder.radius(sphere.getRadius());
    gradientBuilder.proportional(false);
    gradientBuilder.stops(new Stop(0.0, Color.BLUE), new Stop(1.0, Color.BLACK));
    RadialGradient gradient = gradientBuilder.build();

    sphere.setFill(gradient);
    return sphere;
}
 
开发者ID:soziotech,项目名称:Fishification,代码行数:19,代码来源:BubbleEntity.java

示例5: createPlus

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
private void createPlus() {
	Path plus = PathBuilder.create()
			.elements(new MoveTo(5, 0),
					new LineTo(5, 5),
					new LineTo(0, 5),
					new LineTo(0, 10),
					new LineTo(5, 10),
					new LineTo(5, 15),
					new LineTo(10, 15),
					new LineTo(10, 10),
					new LineTo(15, 10),
					new LineTo(15, 5),
					new LineTo(10, 5),
					new LineTo(10, 0),
					new LineTo(5, 0))
			.stroke(Color.web("#000000"))
			.fill(Color.web("#FFFFFF"))
			.strokeWidth(1)
			.rotate(45)
			.cursor(Cursor.HAND)
			.build();
	
	Circle c = CircleBuilder.create().radius(13).style("-fx-fill:-fx-base;").build() ;
	StackPane sp = StackPaneBuilder.create()
								   .maxHeight(26).maxWidth(26)
								   .prefHeight(26).prefWidth(26)
								   .children(c,plus).build();
	root.getChildren().add(sp);
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:30,代码来源:ShapesDemo.java

示例6: getBottom

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
private Node getBottom() {
	StackPane sp = new StackPane();
	sp.setMinHeight(25);
	sp.setAlignment(Pos.TOP_RIGHT);
	Circle c = CircleBuilder.create().fill(Color.RED).translateX(-5).translateY(3).radius(8).cursor(Cursor.HAND).build();
	c.setOnMouseClicked(new EventHandler<MouseEvent>() {
		@Override
		public void handle(MouseEvent paramT) {
			ScenicView.show(scene);
		}
	});
	sp.getChildren().addAll(new Separator(), c);
	return sp;
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:15,代码来源:SineWaveDemo.java

示例7: buildDiseaseStatusIcon

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
private Node buildDiseaseStatusIcon(boolean item) {
	// TODO : Increased verbosity of the code. Here only the color code is changed. you can set the color code in if condition and build
	// a circle with the color code variable.
	Circle circle = null;
	if (item) {
		circle = CircleBuilder.create().radius(5).fill(Color.web("#D9D900")).styleClass("yellowEffect").stroke(Color.web("#D9D900")).build();
	} else {
		circle = CircleBuilder.create().radius(5).fill(Color.web("#5FD095")).styleClass("redEffect").stroke(Color.web("#5FD095")).build();
	}
	return circle;
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:12,代码来源:ToggleButtonGraphicStylingDemo.java

示例8: createFoodCircle

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
private Circle createFoodCircle(double radius) {
    CircleBuilder<?> circleBuilder = CircleBuilder.create();
    circleBuilder.radius(radius);
    circleBuilder.cache(true);
    Circle sphere = circleBuilder.build();
    sphere.setOpacity(FOOD_OPACITY);

    RadialGradientBuilder gradientBuilder = RadialGradientBuilder.create();
    gradientBuilder.centerX(sphere.getCenterX() - sphere.getRadius() / 3);
    gradientBuilder.centerY(sphere.getCenterY() - sphere.getRadius() / 3);
    gradientBuilder.radius(sphere.getRadius());
    gradientBuilder.proportional(false);

    if (m_foodSource.equalsIgnoreCase("twitter")) {
        gradientBuilder.stops(new Stop(0.0, Color.LIGHTCYAN), new Stop(1.0, Color.DARKCYAN));
    } else if (m_foodSource.equalsIgnoreCase("sociotech")) {
        gradientBuilder.stops(new Stop(0.0, Color.GRAY), new Stop(1.0, Color.DARKGRAY));
    } else if (m_foodSource.equalsIgnoreCase("cscm")) {
        gradientBuilder.stops(new Stop(0.4, Color.ORANGE), new Stop(1.0, Color.BLACK));
    } else if (m_foodSource.equalsIgnoreCase("unibwm")) {
        gradientBuilder.stops(new Stop(0.0, Color.DARKORANGE), new Stop(1.0, Color.BLACK));
    } else if (m_foodSource.equalsIgnoreCase("mendeley")) {
        gradientBuilder.stops(new Stop(0.0, Color.RED), new Stop(1.0, Color.BLACK));
    } else if (m_foodSource.equalsIgnoreCase("studiendekan")) {
        gradientBuilder.stops(new Stop(0.0, Color.SANDYBROWN), new Stop(1.0, Color.BLACK));
    } else {
        gradientBuilder.stops(new Stop(0.0, Color.YELLOW), new Stop(1.0, Color.BLACK));
    }
    RadialGradient gradient = gradientBuilder.build();

    sphere.setFill(gradient);
    return sphere;
}
 
开发者ID:soziotech,项目名称:Fishification,代码行数:34,代码来源:FoodItemEntity.java

示例9: start

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
	// Create a pane as the scene root
	Pane root = new Pane();
	
	// position a rectangle absolutely
	// NOTE: A rectangle is drawn from the upper left hand corner
	Rectangle r = RectangleBuilder.create()
			.x(100) // absolute position in container
			.y(100) // absolute position in container
			.fill(Color.AQUA)
			.width(50)
			.height(50)
			.build();
	
	// NOTE: A circle is drawn from the center
	Circle c = CircleBuilder.create()
			.centerX(200)
			.centerY(200)
			.radius(50)
			.fill(Color.ORANGERED)
			.build();
	
	root.getChildren().addAll(r,c);
	
	Scene scene = new Scene(root, 400, 400);
	stage.setScene(scene);
	stage.setTitle("Position Nodes Aboslutely");
	stage.show();
	
	ScenicView.show(scene);
	/*
	 * If you inspect the rectangle and circle with SceniceView, you'll
	 * that they don't have a layoutX/Y. When you position nodes absolutely
	 * layoutX/Y is never set. This isn't a problem, just be aware that it 
	 * happens. It can effect the way you do custom layouts.
	 */
}
 
开发者ID:jeffreyguenther,项目名称:JavaFXTutorials,代码行数:39,代码来源:PositioningNodesAbsolutely.java

示例10: renderGraph

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
/**
 * Render a graph to a particular <code>Group</code>
 * @param graph
 * @param layout
 * @param viz 
 */
private void renderGraph(Graph<String, Number> graph, Layout<String, Number> layout, Group viz) {
    // draw the vertices in the graph
    for (String v : graph.getVertices()) {
        // Get the position of the vertex
        Point2D p = layout.transform(v);
        
        // draw the vertex as a circle
        Circle circle = CircleBuilder.create()
                .centerX(p.getX())
                .centerY(p.getY())
                .radius(CIRCLE_SIZE)
                .build();
        
        // add it to the group, so it is shown on screen
        viz.getChildren().add(circle);
    }

    // draw the edges
    for (Number n : graph.getEdges()) {
        // get the end points of the edge
        Pair<String> endpoints = graph.getEndpoints(n);
        
        // Get the end points as Point2D objects so we can use them in the 
        // builder
        Point2D pStart = layout.transform(endpoints.getFirst());
        Point2D pEnd = layout.transform(endpoints.getSecond());
        
        // Draw the line
        Line line = LineBuilder.create()
                .startX(pStart.getX())
                .startY(pStart.getY())
                .endX(pEnd.getX())
                .endY(pEnd.getY())
                .build();
        // add the edges to the screen
        viz.getChildren().add(line);
    }
}
 
开发者ID:jeffreyguenther,项目名称:JavaFXTutorials,代码行数:45,代码来源:JUNGAndJavaFX.java

示例11: makeCircle

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
private Circle makeCircle(int y, int x) {
    final Circle ball = CircleBuilder.create().radius(RADIUS - 1).centerX(x).centerY(y).build();
    ball.setOnMouseClicked((MouseEvent mouseEvent) -> {
        double newX = MOVE_WAY;
        if (ball.getTranslateX() > 1) {
            newX = 0;
        }
        TranslateTransition move = TranslateTransitionBuilder.create().node(ball).toX(newX).duration(millis(200)).build();
        move.playFromStart();
    });
    return ball;
}
 
开发者ID:ewidgetfx,项目名称:ewidgetfx,代码行数:13,代码来源:Abacus_6_Styled.java

示例12: start

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {


    final TextArea testText = TextAreaBuilder.create()
            .text("Test")
            .prefHeight(50)
            .prefWidth(500)
            .build();

    final ChoiceBox<Interpolator> interpolatorChoiceBox = new ChoiceBox<Interpolator>();
    interpolatorChoiceBox.getItems().addAll(FXCollections.observableArrayList(
                Interpolator.LINEAR,
                Interpolator.DISCRETE,
                Interpolator.EASE_BOTH,
                Interpolator.EASE_IN,
                Interpolator.EASE_OUT
                ));
    interpolatorChoiceBox.setPrefHeight(25);
    interpolatorChoiceBox.setPrefWidth(500);

    interpolatorChoiceBox.getSelectionModel().selectFirst();


    final Text lcdText = TextBuilder.create()
            .x(100)
            .y(100)
            .fontSmoothingType(FontSmoothingType.LCD)
            .build();

    lcdText.textProperty().bind(testText.textProperty());

    final Circle point = CircleBuilder.create()
            .centerX(100)
            .centerY(100)
            .radius(2)
            .fill(Color.RED)
            .build();

    Pane root = VBoxBuilder.create()
            .children(
                PaneBuilder.create()
                .minWidth(500)
                .minHeight(500)
                .children(
                    lcdText,
                    point)
                .onMouseClicked(new EventHandler<MouseEvent>() {

                    @Override
                    public void handle(MouseEvent event) {
                        point.setCenterX(event.getX());
                        point.setCenterY(event.getY());

                        TimelineBuilder.create()
                            .keyFrames(
                                new KeyFrame(Duration.seconds(5),
                                    new KeyValue(lcdText.xProperty(), event.getX(),
                                        interpolatorChoiceBox.getSelectionModel().getSelectedItem())),
                                new KeyFrame(Duration.seconds(5),
                                    new KeyValue(lcdText.yProperty(), event.getY(),
                                        interpolatorChoiceBox.getSelectionModel().getSelectedItem()))
                                )
                            .build()
                            .play();
                    }
                })
                .build(),
                testText,
                interpolatorChoiceBox)
            .build();



    Scene scene = new Scene(root, 500, 575);

    primaryStage.setTitle("Test Animnation LCD Text");
    primaryStage.setResizable(false);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:82,代码来源:AnimationLCDTextTestApp.java

示例13: addGraphicControl

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
public void addGraphicControl(final String title,
    final ObjectProperty<Node> graphicProperty) {

final Node circle  = CircleBuilder.create().radius(4).fill(Color.ORANGE).build();
final Node square  = RectangleBuilder.create().width(8).height(8).build();
final Node text  = TextBuilder.create().text("test").build();

final ComboBox<Node> choices = new ComboBox<Node>(FXCollections.observableArrayList(circle, square, text));
choices.setCellFactory(new Callback<ListView<Node>, ListCell<Node>>() {
    @Override
    public ListCell<Node> call(final ListView<Node> param) {
	final ListCell<Node> cell = new ListCell<Node>() {
	    @Override
	    public void updateItem(final Node item, final boolean empty) {
		super.updateItem(item, empty);
		if (item != null) {
		    setText(item.getClass().getSimpleName());
		} else {
		    setText(null);
		}
	    }
	};
	return cell;
    }
});
choices.getSelectionModel().select(0);
graphicProperty.bind(choices.valueProperty());

final VBox box = new VBox();
final Text titleText = new Text(title);

titleText.textProperty().bind(new StringBinding() {
    {
	super.bind(choices.selectionModelProperty());
    }

    @Override
    protected String computeValue() {
	return title + " : "
		+ String.valueOf(choices.selectionModelProperty().get().getSelectedItem().getClass().getSimpleName());
    }

});
box.getChildren().addAll(titleText, choices);
getChildren().add(box);

   }
 
开发者ID:MrLoNee,项目名称:RadialFx,代码行数:48,代码来源:DemoUtil.java

示例14: start

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
	// Create a pane as the scene root
	Pane root = new Pane();
	
	// position a rectangle absolutely
	// NOTE: A rectangle is drawn from the upper left hand corner
	Rectangle r = RectangleBuilder.create()
			.x(0) // absolute position in container
			.y(0) // absolute position in container
			.fill(Color.AQUA)
			.width(50)
			.height(50)
			.build();
	r.relocate(100, 100);
	
	// NOTE: A circle is drawn from the center
	Circle c = CircleBuilder.create()
			.centerX(0)
			.centerY(0)
			.radius(50)
			.fill(Color.ORANGERED)
			.build();
	c.relocate(200, 200);
	
	root.getChildren().addAll(r,c);
	
	Scene scene = new Scene(root, 400, 400);
	stage.setScene(scene);
	stage.setTitle("Position Nodes With Relocate");
	stage.show();
	
	ScenicView.show(scene);
	/*
	 * This approach treats the shape as its own coordinate system and uses
	 * layoutX/Y to position the nodes.
	 * 
	 * Check layoutX/Y for the circle. Notice anything strange? It's position
	 * says it is 250, 250. What?! Remember that when you use relocate(x, y)
	 * it does the calculation finalX - getLayoutBounds().getMinX().
	 * Because a circle is drawn from the center it's layout bounds are
	 * [-50, -50, 100, 100]. 200 - -50 is 250. If you want to know the
	 * position of the circle in the parent container, use 
	 * boundsInParent.getMinX/Y(). This also works for rectangles.
	 */
}
 
开发者ID:jeffreyguenther,项目名称:JavaFXTutorials,代码行数:47,代码来源:PositioningNodesWithRelocate.java

示例15: start

import javafx.scene.shape.CircleBuilder; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
	// Create a pane as the scene root
	Pane root = new Pane();
	
	// position a rectangle absolutely
	// NOTE: A rectangle is drawn from the upper left hand corner
	Rectangle r = RectangleBuilder.create()
			.x(0) // absolute position in container
			.y(0) // absolute position in container
			.fill(Color.AQUA)
			.width(50)
			.height(50)
			.build();
	r.relocate(100, 100);
	
	// NOTE: A circle is drawn from the center
	Circle c = CircleBuilder.create()
			.centerX(0)
			.centerY(0)
			.radius(50)
			.fill(Color.ORANGERED)
			.build();
	c.relocate(200, 200);
	
	Group g = new Group(r, c);
	g.relocate(0, 0); // add/remove this line to see the effect of relocate 
	root.getChildren().add(g);
	
	
	Scene scene = new Scene(root, 400, 400);
	stage.setScene(scene);
	stage.setTitle("Position Nodes With Relocate");
	stage.show();
	
	ScenicView.show(scene);
	
	/*
	 *By default the bounds of the Group will be the sum of it's children's
	 *bounds. If we don't set it's position with relocate, we'll need to use
	 *BoundsInParent.getMinX/Y() to get it's position. 
	 *
	 *Notice also that if we don't call g.relocate() the circles and rectangles
	 *positions appear to be with respect to the Pane's coordinate system. That is 
	 *the Group is just wrapping the rectangle and circle. The only way we
	 *can treat a Group like a coordinate system is use relocate to position
	 *it. Then it behaves as we might expect.
	 */
	
}
 
开发者ID:jeffreyguenther,项目名称:JavaFXTutorials,代码行数:51,代码来源:PositioningObjectsInGroups.java


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