Rounded corners for Swing JButton Swing without features of actual JButton

10,165

You can easily use a Java Swing theme like Nimbus.

Or check out Stack Overflow question Make a button round.

Share:
10,165
user2822187
Author by

user2822187

Updated on June 04, 2022

Comments

  • user2822187
    user2822187 about 2 years

    ![1

    I have gone through the code on Java documentation for Swing look and feel, but I could not find much about how to modify the default look of JButtons.

    I want to have rounded/curved corners for JButtons in Swing.

    Is there a way to achieve this? What functions and values should I use?

    I have used the statement below:

      generateButton.setBorder(new RoundedBorder(20));
    

    The code for RoundedBorder I found in Stack Overflow question Rounded Swing JButton using Java:

    I do get a black rounded border outline around the original button. MY button has orange background. But it doesn't remove the orange area outside the rounded corners. Also I do not want the black border.

    How should I go about this?

  • user2822187
    user2822187 over 10 years
    Thanks I implemented Nimbus.. I have upvoted your answer. See my answer too..
  • Amila Iddamalgoda
    Amila Iddamalgoda over 10 years
    If this answer is useful and correct for your question you can upvote it. :0
  • Tell Me How
    Tell Me How almost 9 years