File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Circular Buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Circular Buttons" Watch "Circular Buttons" New topic

Circular Buttons

Sameera Abeysinghe
Ranch Hand

Joined: Nov 15, 2004
Posts: 104
Hi All,

how can i make 100% circular buttons. normally JButton comes as a square. evan i put a icon image and set null background, null border and setOpaque to false it will shoe it's like a circular button but true is it is not and it is not acting like a circular button so my problem is how to make a 100 % circular button

Thanks Lot
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Sameera Abeysinghe
Ranch Hand

Joined: Nov 15, 2004
Posts: 104
Thanks a lot
Following is my code I am using at now

So instead of creating JButton objects if I create RoundButton objects will my code work
( RoundButton � it is a class shown in the link show above)
Amit Goel
Ranch Hand

Joined: Dec 07, 2000
Posts: 50
Hi Sameera,

Here is another workaround..

Use AWT graphics object and create a button on ur own. I mean instead of using JButton, create a round figure with bevel effect which will look similar to a JButton and then using MouseMove and mosueClick method and verifying the co-ordinates , u can simulate the click action.

this will give you 100% round button without any invisible square areas ..

if you liked this and want to have more details.mail me at

Amit<br /> <br />The Less I have, The more I gain..Off the Beaten Path, I Reign.
I agree. Here's the link:
subject: Circular Buttons
It's not a secret anymore!