This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Circular Buttons

 
Sameera Abeysinghe
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
 
Sameera Abeysinghe
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic