Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JButton with ImageIcon Size Problem

 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a JButton with an ImageIcon showing just fine.
I need to be able to resize the button and of course its icon, but when the button gets to small the icon disappears.
Is there a way I can dynamically change the size of the icon to fit the JButton? Or am I stuck making several icon files?
Thank You in Advance for Your Help,
Lou
 
KR Campbell
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If you are using an ImageIcon then it has a getScaledInstance() method. I seem to remember using this for something similar once.
Regards,
Ken
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Craig!
That is exactly what I needed!
Lou
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic