Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

About setting icon on JButton  RSS feed

 
Tony Chow
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Recently I have been working on an executable launcher. I tried to get the executable icons and set them on the JButtons. Still there are some problems.
Here is a part of the code:

Here the getConfig() method is already defined to get a string in a "properties" file.

However, the icons are very small and they don't fill the entire button.



How can the icon fill the entire button (for example, having a custom size of 48x48, or automatically filled the button)? The frame will not be resized.

Here is the whole code...


Please help...
 
Rob Camick
Ranch Hand
Posts: 2752
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can the icon fill the entire button (for example, having a custom size of 48x48, or automatically filled the button)?


Well scaling up a small icon will cause pixilation so you are better to create larger icons.

Anyway, you should be able to use Darryl's Stretch Icon which will do scaling on the fly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!