本文整理汇总了Java中javafx.scene.shape.Ellipse.getCenterY方法的典型用法代码示例。如果您正苦于以下问题:Java Ellipse.getCenterY方法的具体用法?Java Ellipse.getCenterY怎么用?Java Ellipse.getCenterY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Ellipse
的用法示例。
在下文中一共展示了Ellipse.getCenterY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertEllipse
import javafx.scene.shape.Ellipse; //导入方法依赖的package包/类
public static String convertEllipse(final Ellipse ELLIPSE) {
final StringBuilder fxPath = new StringBuilder();
final double CENTER_X = ELLIPSE.getCenterX() == 0 ? ELLIPSE.getRadiusX() : ELLIPSE.getCenterX();
final double CENTER_Y = ELLIPSE.getCenterY() == 0 ? ELLIPSE.getRadiusY() : ELLIPSE.getCenterY();
final double RADIUS_X = ELLIPSE.getRadiusX();
final double RADIUS_Y = ELLIPSE.getRadiusY();
final double CONTROL_DISTANCE_X = RADIUS_X * KAPPA;
final double CONTROL_DISTANCE_Y = RADIUS_Y * KAPPA;
// Move to first point
fxPath.append("M ").append(CENTER_X).append(" ").append(CENTER_Y - RADIUS_Y).append(" ");
// 1. quadrant
fxPath.append("C ").append(CENTER_X + CONTROL_DISTANCE_X).append(" ").append(CENTER_Y - RADIUS_Y).append(" ")
.append(CENTER_X + RADIUS_X).append(" ").append(CENTER_Y - CONTROL_DISTANCE_Y).append(" ")
.append(CENTER_X + RADIUS_X).append(" ").append(CENTER_Y).append(" ");
// 2. quadrant
fxPath.append("C ").append(CENTER_X + RADIUS_X).append(" ").append(CENTER_Y + CONTROL_DISTANCE_Y).append(" ")
.append(CENTER_X + CONTROL_DISTANCE_X).append(" ").append(CENTER_Y + RADIUS_Y).append(" ")
.append(CENTER_X).append(" ").append(CENTER_Y + RADIUS_Y).append(" ");
// 3. quadrant
fxPath.append("C ").append(CENTER_X - CONTROL_DISTANCE_X).append(" ").append(CENTER_Y + RADIUS_Y).append(" ")
.append(CENTER_X - RADIUS_X).append(" ").append(CENTER_Y + CONTROL_DISTANCE_Y).append(" ")
.append(CENTER_X - RADIUS_X).append(" ").append(CENTER_Y).append(" ");
// 4. quadrant
fxPath.append("C ").append(CENTER_X - RADIUS_X).append(" ").append(CENTER_Y - CONTROL_DISTANCE_Y).append(" ")
.append(CENTER_X - CONTROL_DISTANCE_X).append(" ").append(CENTER_Y - RADIUS_Y).append(" ")
.append(CENTER_X).append(" ").append(CENTER_Y - RADIUS_Y).append(" ");
// Close path
fxPath.append("Z");
return fxPath.toString();
}
示例2: start
import javafx.scene.shape.Ellipse; //导入方法依赖的package包/类
@Override // Override the start method in the Applicaton class
public void start(Stage primaryStage) {
// Create a pane
Pane pane = new Pane();
// Create an ellipse and set its properties
Ellipse ellipse = new Ellipse(75, 40, 50, 20);
ellipse.setStroke(Color.BLACK);
ellipse.setFill(Color.WHITE);
// Create two Arcs and set their properties
Arc arc1 = new Arc(ellipse.getCenterX(), 150, ellipse.getRadiusX(),
ellipse.getRadiusY(), 0, -180);
arc1.setType(ArcType.OPEN);
arc1.setFill(Color.WHITE);
arc1.setStroke(Color.BLACK);
Arc arc2 = new Arc(ellipse.getCenterX(), arc1.getCenterY(),
ellipse.getRadiusX(), ellipse.getRadiusY(), 0, 180);
arc2.setType(ArcType.OPEN);
arc2.setFill(Color.WHITE);
arc2.setStroke(Color.BLACK);
arc2.getStrokeDashArray().addAll(6.0, 21.0);
// Create two lines and set thier properties
Line line1 = new Line(ellipse.getCenterX() - ellipse.getRadiusX(),
ellipse.getCenterY(), ellipse.getCenterX() - ellipse.getRadiusX(),
arc1.getCenterY());
Line line2 = new Line((ellipse.getCenterX() - ellipse.getRadiusX()) +
ellipse.getRadiusX() * 2, ellipse.getCenterY(),
(ellipse.getCenterX() - ellipse.getRadiusX())
+ ellipse.getRadiusX() * 2, arc1.getCenterY());
// Place nodes in pane
pane.getChildren().addAll(ellipse, arc1, arc2, line1, line2);
// Create a scene and place it in the stage
Scene scene = new Scene(pane, 150, 200);
primaryStage.setTitle("Exercise_14_10"); // Set the stage title
primaryStage.setScene(scene); // Place the scenen in the stage
primaryStage.show(); // Display the stage
}
示例3: getCircle
import javafx.scene.shape.Ellipse; //导入方法依赖的package包/类
/** Return a circle of specified properties */
private Circle getCircle(Ellipse e) {
Circle c = new Circle(e.getCenterX(), e.getCenterY(),
e.getRadiusY() - (e.getRadiusX() - e.getRadiusY()));
return c;
}
示例4: convertEllipse
import javafx.scene.shape.Ellipse; //导入方法依赖的package包/类
public static String convertEllipse(final Ellipse ELLIPSE) {
final StringBuilder fxPath = new StringBuilder();
final double CENTER_X = ELLIPSE.getCenterX() == 0 ? ELLIPSE.getRadiusX() : ELLIPSE.getCenterX();
final double CENTER_Y = ELLIPSE.getCenterY() == 0 ? ELLIPSE.getRadiusY() : ELLIPSE.getCenterY();
final double RADIUS_X = ELLIPSE.getRadiusX();
final double RADIUS_Y = ELLIPSE.getRadiusY();
final double CONTROL_DISTANCE_X = RADIUS_X * KAPPA;
final double CONTROL_DISTANCE_Y = RADIUS_Y * KAPPA;
// Move to first point
fxPath.append("M ").append(CENTER_X).append(" ").append(CENTER_Y - RADIUS_Y).append(" ");
// 1. quadrant
fxPath
.append("C ")
.append(CENTER_X + CONTROL_DISTANCE_X)
.append(" ")
.append(CENTER_Y - RADIUS_Y)
.append(" ")
.append(CENTER_X + RADIUS_X)
.append(" ")
.append(CENTER_Y - CONTROL_DISTANCE_Y)
.append(" ")
.append(CENTER_X + RADIUS_X)
.append(" ")
.append(CENTER_Y)
.append(" ");
// 2. quadrant
fxPath
.append("C ")
.append(CENTER_X + RADIUS_X)
.append(" ")
.append(CENTER_Y + CONTROL_DISTANCE_Y)
.append(" ")
.append(CENTER_X + CONTROL_DISTANCE_X)
.append(" ")
.append(CENTER_Y + RADIUS_Y)
.append(" ")
.append(CENTER_X)
.append(" ")
.append(CENTER_Y + RADIUS_Y)
.append(" ");
// 3. quadrant
fxPath
.append("C ")
.append(CENTER_X - CONTROL_DISTANCE_X)
.append(" ")
.append(CENTER_Y + RADIUS_Y)
.append(" ")
.append(CENTER_X - RADIUS_X)
.append(" ")
.append(CENTER_Y + CONTROL_DISTANCE_Y)
.append(" ")
.append(CENTER_X - RADIUS_X)
.append(" ")
.append(CENTER_Y)
.append(" ");
// 4. quadrant
fxPath
.append("C ")
.append(CENTER_X - RADIUS_X)
.append(" ")
.append(CENTER_Y - CONTROL_DISTANCE_Y)
.append(" ")
.append(CENTER_X - CONTROL_DISTANCE_X)
.append(" ")
.append(CENTER_Y - RADIUS_Y)
.append(" ")
.append(CENTER_X)
.append(" ")
.append(CENTER_Y - RADIUS_Y)
.append(" ");
// Close path
fxPath.append("Z");
return fxPath.toString();
}