aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JButton with a round image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JButton with a round image" Watch "JButton with a round image" New topic
Author

JButton with a round image

Alexandre Baldo
Ranch Hand

Joined: Aug 04, 2006
Posts: 48
Hello guys!
I'll try to explain the problem...
I have a JButton:


The ImageIcon is a GIF. A round GIF.
The problema is that when the button is displayed the addButton's border appears as well (there's a rect surrounding it)... I want just the Image to be shown!

Does anyone knows how can I do that?

Thank's!!


...ops!<br>-----------------<br>
SCJD<br>
SCWCD 1.4<br>
SCJP 1.4
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Try addButton.setBorderPainted(false)

http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/AbstractButton.html#setBorderPainted(boolean)


GenRocket - Experts at Building Test Data
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

On XP LAF setBorderPainted(false) might not be sufficient. You might have to use addButton.setBorder(null)


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40034
    
  28
Worth doing a search of this forum; questions about round buttons come up about twice a year. If you find anything useful, be sure to post a link to it with the URL button below.
Alexandre Baldo
Ranch Hand

Joined: Aug 04, 2006
Posts: 48
Thank`s guys!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JButton with a round image