Issue
I'm having some problems with this view. What I need to do it in JavaFX to add this 'border' and divide the circle into 2 parts.
public void start(Stage primaryStage){
Circle mycircle = new Circle(200,200,200);
mycircle.setFill(Color.GREEN);
BorderPane root = new BorderPane();
root.setCenter(mycircle);
}
I don't have errors but it's not the view what I am looking for. So can anyone help me with this, please
And btw sorry for bad image quality
Solution
Would this satisfy your needs?
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
public class HalfCircleDemo extends Application {
@Override
public void start(final Stage stage) {
BorderPane root = new BorderPane();
Group circleGroup = new Group();
Circle greenCircle = new Circle(200,200,200);
greenCircle.setFill(Color.GREEN);
Circle blueCircle = new Circle(200,200,200);
blueCircle.setFill(Color.BLUE);
Rectangle clip = new Rectangle(400, 200);
greenCircle.setClip(clip);
circleGroup.getChildren().setAll(blueCircle, greenCircle);
root.setCenter(circleGroup);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Answered By - mipa
Answer Checked By - Candace Johnson (JavaFixing Volunteer)