wood burning stoves
The moose likes Swing / AWT / SWT and the fly likes JButtons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JButtons" Watch "JButtons" New topic


colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 750
Hi, I'm trying to put some images on JButtons, eg

I've discovered that the size of the image that should fit perfectly into the JButton, should be 4 pixels less in width, and 4 pixels less in height.
The JButton above is 62 by 25, and an image 58 by 21 fits perfectly inside it.

But when I used a JButton that was 25 by 25, and I tried to put an image that was 21 by 21 inside it, the image was displayed 1 pixel right, leaving a vertical gray line to the left of the image inside the JButton, and the far right edge of image (1 pixel wide) could not be seen.

I was wondering if there was any convention of image sizes in relation to the JButtons they fit inside.
I agree. Here's the link: http://aspose.com/file-tools
subject: JButtons
It's not a secret anymore!