File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JButton with ImageIcon Size Problem

 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • 0
  • 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
  • 0
  • 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
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Craig!
That is exactly what I needed!
Lou
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic