Java Code Examples for javafx.scene.shape.Ellipse#setCenterY()

The following examples show how to use javafx.scene.shape.Ellipse#setCenterY() . 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: Main.java    From JavaFX with MIT License 6 votes vote down vote up
@Override
public void start(Stage primaryStage) throws IOException {
	Group root = new Group();
	// describes the window itself: name, size
	primaryStage.setTitle(" Aufgabe 10 by John Malc ");
	primaryStage.setScene(new Scene(root));
	// say: center on screen, user can resize, and it will in general exists
	primaryStage.centerOnScreen();
	primaryStage.setResizable(true);
	primaryStage.show();

	// Ellipse alone
	Ellipse a = new Ellipse();
	a.setFill(Color.RED);
	a.setCenterX(205);
	a.setCenterY(150);
	a.setRadiusX(80);
	a.setRadiusY(30);

	// shows Ellipse and it will add it to the group
	root.getChildren().add(new Group(a));
}
 
Example 2
Source File: Exercise_14_11.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
/** Return an Ellipse of specified properties */
private Ellipse getEllipse(Circle c) {
	Ellipse e = new Ellipse();
	e.setCenterY(c.getRadius() - c.getRadius() / 3);
	e.setRadiusX(c.getRadius() / 4);
	e.setRadiusY(c.getRadius() / 3 - 20);
	e.setStroke(Color.BLACK);
	e.setFill(Color.WHITE);
	return e; 
}