java - resizing a ImageIcon in a JButton -


I am creating a pocketlet that contains a specific imitie. The main issue is that the size of the original icon is much larger than the size of the button. As a result of the button's display, only a part of the icon can be seen. What is the way to resize an image icon to fit inside a pocket button?

  image img = icon.getImage (); Image newimg = img.getScaledInstance (NEW_WIDTH, NEW_HEIGHT, java.awt.Image.SCALE_SMOOTH); Icon = new image icon (newimg);  

to


Comments