my dog learned polymorphism*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Circular Buttons" Watch "Circular Buttons" New topic
Author

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
http://java.sun.com/developer/TechTips/1999/tt0826.html
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 amitgoel1287@yahoo.com


Amit<br /> <br />The Less I have, The more I gain..Off the Beaten Path, I Reign.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Circular Buttons