Java ImageIcon SetStandardSizeForImage(ImageIcon icon)

Here you can find the source of SetStandardSizeForImage(ImageIcon icon)

Description

Set Standard Size For Image

License

Open Source License

Declaration

public static Icon SetStandardSizeForImage(ImageIcon icon) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import javax.swing.Icon;
import javax.swing.ImageIcon;

public class Main {
    public static Icon SetStandardSizeForImage(ImageIcon icon) {
        Image img = icon.getImage();
        BufferedImage bi = new BufferedImage(50, 50, BufferedImage.TYPE_INT_ARGB);
        Graphics g = bi.createGraphics();
        g.drawImage(img, 0, 0, 50, 50, null);
        Icon newIcon = new ImageIcon(bi);
        return newIcon;

    }/*from  w ww.  ja  va 2s .c om*/
}

Related

  1. prepareImage(ImageIcon icon, int x, int y)
  2. saveImage(ImageIcon picture, String targetfile)
  3. setDefaultImageIcons(Window window)
  4. setImageIcon(ImageIcon icon, String description)
  5. setImageIcon(JLabel label, URL url)
  6. setVerBumpIcon(ImageIcon icon)
  7. showLogo(ImageIcon logo)
  8. showLogoProgressBar(ImageIcon logo, int steps)
  9. showSplash(ImageIcon image, int milliseconds)