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 631521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:58:28+00:00 2026-05-13T19:58:28+00:00

I am trying to display a circular object in my gui, the circular object

  • 0

I am trying to display a circular object in my gui, the circular object should contain a few labels therefore I thought the circle object should extend JPanel. Does anyone know how to make a circular JPanel? Or at least a JPanel which paints an oval and places a few JLables in the centre of the oval?

Thanks

  • 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-13T19:58:29+00:00Added an answer on May 13, 2026 at 7:58 pm

    To paint a circle, subclass JPanel and override paintComponent:

    public class CirclePanel extends JPanel {
    
        @Override
        protected void paintComponent(Graphics g) {
            g.drawOval(0, 0, g.getClipBounds().width, g.getClipBounds().height);
        }
    }
    

    Looks like this:

    alt text http://img246.imageshack.us/img246/3708/so2343233.png

    To place the labels, you could use GridBagLayout, hope that’s what you want:

    CirclePanel panel = new CirclePanel();
    
    panel.setLayout(new GridBagLayout());
    
    GridBagConstraints gc;
    
    gc = new GridBagConstraints();
    gc.gridy = 0;
    panel.add(new JLabel("Label 1"), gc);
    
    gc = new GridBagConstraints();
    gc.gridy = 1;
    panel.add(new JLabel("Label 2"), gc);
    

    alt text http://img694.imageshack.us/img694/4013/so23432332.png

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

Sidebar

Ask A Question

Stats

  • Questions 304k
  • Answers 305k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is what we use to do a similar thing… May 13, 2026 at 8:57 pm
  • Editorial Team
    Editorial Team added an answer Most references are implemented using a pointer variable i.e. a… May 13, 2026 at 8:57 pm
  • Editorial Team
    Editorial Team added an answer The static page functionality of WordPress is called, cleverly, "Pages."… May 13, 2026 at 8:57 pm

Related Questions

I have worked a bit with Django and I quite like its project/applications model
I am currently trying to create a menu system for a game and cannot
I am trying to display a list of all files found in the selected
I am trying to display a pie chart that shows sales by company. However
I am trying to display a live word count in the vim statusline. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.