本文整理汇总了Java中javafx.scene.shape.Circle.setTranslateY方法的典型用法代码示例。如果您正苦于以下问题:Java Circle.setTranslateY方法的具体用法?Java Circle.setTranslateY怎么用?Java Circle.setTranslateY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Circle
的用法示例。
在下文中一共展示了Circle.setTranslateY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TranslateTransitionSample
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
public TranslateTransitionSample() {
super(400,40);
Circle circle = new Circle(20, Color.CRIMSON);
circle.setTranslateX(20);
circle.setTranslateY(20);
getChildren().add(circle);
translateTransition = new TranslateTransition(Duration.seconds(4),circle);
translateTransition.setFromX(20);
translateTransition.setToX(380);
translateTransition.setCycleCount(Timeline.INDEFINITE);
translateTransition.setAutoReverse(true);
translateTransition = TranslateTransitionBuilder.create()
.duration(Duration.seconds(4))
.node(circle)
.fromX(20)
.toX(380)
.cycleCount(Timeline.INDEFINITE)
.autoReverse(true)
.build();
}
示例2: start
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
if (primaryStage == null) {
return;
}
//Create Circles
Circle circleRed = new Circle(50.0, Color.RED);
circleRed.setCursor(Cursor.HAND);
circleRed.setOnMousePressed(circleOnMousePressedEventHandler);
circleRed.setOnMouseDragged(circleOnMouseDraggedEventHandler);
Circle circleGreen = new Circle(50.0, Color.GREEN);
circleGreen.setCursor(Cursor.MOVE);
circleGreen.setCenterX(150);
circleGreen.setCenterY(150);
circleGreen.setOnMousePressed(circleOnMousePressedEventHandler);
circleGreen.setOnMouseDragged(circleOnMouseDraggedEventHandler);
Circle circleBlue = new Circle(50.0, Color.BLUE);
circleBlue.setCursor(Cursor.CROSSHAIR);
circleBlue.setTranslateX(300);
circleBlue.setTranslateY(100);
circleBlue.setOnMousePressed(circleOnMousePressedEventHandler);
circleBlue.setOnMouseDragged(circleOnMouseDraggedEventHandler);
Group root = new Group();
root.getChildren().addAll(circleRed, circleGreen, circleBlue);
primaryStage.setResizable(false);
primaryStage.setScene(new Scene(root, 400,350));
primaryStage.setTitle("java-buddy");
primaryStage.show();
}