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

  • Home
  • SEARCH
  • 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 5980433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:48:00+00:00 2026-05-22T21:48:00+00:00

I have to draw precise archs in java. I am currenlty using Graphics2D.fillArc(). The

  • 0

I have to draw precise archs in java. I am currenlty using Graphics2D.fillArc(). The problem is that it only accepts ints and the archs are not precise and i cant make the archs degree increase smoothly. Does anyone know a workaround this?

  • 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-05-22T21:48:01+00:00Added an answer on May 22, 2026 at 9:48 pm

    Here’s my SSCCE using Arc2D.

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.Arc2D;
    import javax.swing.*;
    
    @SuppressWarnings("serial")
    public class ChangingArcs extends JPanel {
       private static final Color ARC_FILL_COLOR = Color.RED;
       private static final int TIMER_DELAY = 20;
       private static final int ARC_X = 100;
       private static final int ARC_Y = 100;
       private static final int ARC_W = 500;
       private static final int ARC_H = 500;
       protected static final double DELTA_EXTEND = 0.5;
       private Arc2D arc;
       private double extend = 0;
    
       public ChangingArcs() {
          new Timer(TIMER_DELAY, new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                extend += DELTA_EXTEND;
                extend %= 360;
                double start = -extend/2;
                arc = new Arc2D.Double(ARC_X, ARC_Y, ARC_W, ARC_H, start, extend, Arc2D.PIE);
                repaint();
             }
          }).start();
       }
    
       public Dimension getPreferredSize() {
          return new Dimension(ARC_W + 2 * ARC_X, ARC_H + 2 * ARC_Y);
       }
    
       @Override
       protected void paintComponent(Graphics g) {
          super.paintComponent(g);
          Graphics2D g2 = (Graphics2D)g;
          if (arc != null) {
             g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
             g2.setColor(ARC_FILL_COLOR);
             g2.fill(arc);
          }
       }
    
       private static void createAndShowUI() {
          JFrame frame = new JFrame("ChangingArcs");
          frame.getContentPane().add(new ChangingArcs());
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.pack();
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
       }
    
       public static void main(String[] args) {
          java.awt.EventQueue.invokeLater(new Runnable() {
             public void run() {
                createAndShowUI();
             }
          });
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to draw a spider web using data structures. not so big on
I have to draw a colored map on a graph. The problem is that
I have a function that draw an image on graphics: private void DrawSmallImage(Graphics g)
I have a ImageView and draw some things on that view. Now I want
I have a mapping application that needs to draw a path, and then display
I have a line that I draw in a window and I let the
I have some code in .Net to draw some text content using GDI+. I
I have my program that can draw rectangles. I have two problems I can't
I have a project that in those i draw some shape from some layer.
I have to draw a small finite state machine that has some reflexive transitions

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.