The moose likes Java in General and the fly likes Round Buttons in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Round Buttons in Java" Watch "Round Buttons in Java" New topic

Round Buttons in Java

bhuvan gupta

Joined: Mar 26, 2001
Posts: 13
Hi All ,
For my java based application I need round buttons .. Can anyone help me out and give me sugesstions on how to customise JButton to make it round displayed in Visual Age for Java
Thanks in Advance ...
timothy zimmerman
Ranch Hand

Joined: Jun 26, 2001
Posts: 149
A quick and relatively easy solution might be to create a round image with the look you want for the button then create a JButton and an ImageIcon ( using the previously created image ).
button.setIcon(imageIcon); //set the button to use the image
button.setBorderPainted(false); //so you don't see the edges of the button
Of course the drawback is that the background of image must match the background of the component you add the button to.
I suppose there are other ways such as extending the JButton class but off the top of my head, I'm afraid I couldn't be much help in that approach.
Hope this was some help.
Scott Palmer
Ranch Hand

Joined: Jul 11, 2001
Posts: 31
There is a tech tips about this on
bhuvan gupta

Joined: Mar 26, 2001
Posts: 13
Thanks Scott and timothy
I agree. Here's the link:
subject: Round Buttons in Java
It's not a secret anymore!