Skip to content

Instantly share code, notes, and snippets.

@darylwong
Created April 20, 2015 13:49
Show Gist options
  • Save darylwong/4005c06cbfe9ec34c1b0 to your computer and use it in GitHub Desktop.
Save darylwong/4005c06cbfe9ec34c1b0 to your computer and use it in GitHub Desktop.
Setting absolute position for Circle object
package javafxapplication12;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
public class CirclePosition extends Application {
@Override
public void start(Stage stage) {
stage.setTitle("Codecrawl.com");
Pane pane = new Pane();
Scene scene = new Scene(pane, 500, 400);
stage.setScene(scene);
pane.setStyle("-fx-background-color: lightgray;");
Circle circle = new Circle();
circle.setCenterX(120);
circle.setCenterY(250);
circle.setRadius(50);
circle.setFill(Color.CORNFLOWERBLUE);
pane.getChildren().add(circle);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment