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


Java Ellipse.getCenterY方法代码示例

本文整理汇总了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();
}
 
开发者ID:Simego,项目名称:FXImgurUploader,代码行数:31,代码来源:ShapeConverter.java

示例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
}
 
开发者ID:jsquared21,项目名称:Intro-to-Java-Programming,代码行数:43,代码来源:Exercise_14_10.java

示例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;
}
 
开发者ID:jsquared21,项目名称:Intro-to-Java-Programming,代码行数:7,代码来源:Exercise_14_11.java

示例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();
}
 
开发者ID:stefaneidelloth,项目名称:JavaFxNodeToSvg,代码行数:75,代码来源:ShapeConverter.java


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