Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8305305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:05:16+00:00 2026-06-08T18:05:16+00:00

I would like to know how to draw a semi circle in JavaFX. I

  • 0

I would like to know how to draw a semi circle in JavaFX. I tried to use Shape and QuadCurve but I couldn’t make a perfect semicircle.

Here is a picture of what I’m trying to draw :

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:05:17+00:00Added an answer on June 8, 2026 at 6:05 pm

    The picture you linked is actually a semi-ring. You can get it in JavaFX by drawing nested 2 arcs and some lines. But my preferred way is to use the Path.

    public class SemiDemo extends Application {
    
        @Override
        public void start(Stage primaryStage) {
    
            Group root = new Group();
            root.getChildren().add(drawSemiRing(120, 120, 100, 50, Color.LIGHTGREEN, Color.DARKGREEN));
            root.getChildren().add(drawSemiRing(350, 350, 200, 30, Color.LIGHTSKYBLUE, Color.DARKBLUE));
    
            Scene scene = new Scene(root, 300, 250);
            primaryStage.setScene(scene);
            primaryStage.show();
        }
    
        private Path drawSemiRing(double centerX, double centerY, double radius, double innerRadius, Color bgColor, Color strkColor) {
            Path path = new Path();
            path.setFill(bgColor);
            path.setStroke(strkColor);
            path.setFillRule(FillRule.EVEN_ODD);
    
            MoveTo moveTo = new MoveTo();
            moveTo.setX(centerX + innerRadius);
            moveTo.setY(centerY);
    
            ArcTo arcToInner = new ArcTo();
            arcToInner.setX(centerX - innerRadius);
            arcToInner.setY(centerY);
            arcToInner.setRadiusX(innerRadius);
            arcToInner.setRadiusY(innerRadius);
    
            MoveTo moveTo2 = new MoveTo();
            moveTo2.setX(centerX + innerRadius);
            moveTo2.setY(centerY);
    
            HLineTo hLineToRightLeg = new HLineTo();
            hLineToRightLeg.setX(centerX + radius);
    
            ArcTo arcTo = new ArcTo();
            arcTo.setX(centerX - radius);
            arcTo.setY(centerY);
            arcTo.setRadiusX(radius);
            arcTo.setRadiusY(radius);
    
            HLineTo hLineToLeftLeg = new HLineTo();
            hLineToLeftLeg.setX(centerX - innerRadius);
    
            path.getElements().add(moveTo);
            path.getElements().add(arcToInner);
            path.getElements().add(moveTo2);
            path.getElements().add(hLineToRightLeg);
            path.getElements().add(arcTo);
            path.getElements().add(hLineToLeftLeg);
    
            return path;
        }
    
        public static void main(String[] args) {
            launch(args);
        }
    }
    

    Refer to Shape API of JavaFX for more info about the shapes used in the code.
    Screenshot:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use glDrawArrays(GL_POINTS,...) to draw harmonic wave. I would like to know the order
I know the parametric equations to 'hand draw' a circle. I would like to
Possible Duplicate: Draw Circle using css alone I would like to know if there
i would like know some reference. I know i can googling it. but prefer
I would like to know what code to use to convert a double[] array
I would like to know how to draw 100 rectangles with SVG. I made
I would like to make a shape recognition program that would trace a mouse
I would like to know what kind of data structure (queue) I should use
I would like to know the easiest way to draw a straight line between
I currently use LWJGL Textures to draw images on the screen. I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.