Java ImageIcon Create createImageIcon(URL url, String description, Integer w, Integer h)

Here you can find the source of createImageIcon(URL url, String description, Integer w, Integer h)

Description

create Image Icon

License

Open Source License

Declaration

public static ImageIcon createImageIcon(URL url, String description, Integer w, Integer h) 

Method Source Code

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

import java.net.URL;
import javax.swing.ImageIcon;

public class Main {
    public static ImageIcon createImageIcon(URL url, Integer w, Integer h) {
        return createImageIcon(url, null, w, h);
    }/*from ww  w.  jav  a2 s. c  o m*/

    public static ImageIcon createImageIcon(URL url, String description, Integer w, Integer h) {
        ImageIcon imageIcon = new ImageIcon(url, description);
        if (w != null && h != null) {
            imageIcon = new ImageIcon(imageIcon.getImage().getScaledInstance(w, h, java.awt.Image.SCALE_SMOOTH));
        }
        return imageIcon;
    }
}

Related

  1. createImageIcon(String path, int width, int height)
  2. createImageIcon(String path, String description)
  3. createImageIcon(String path, String description)
  4. createImageIcon(String resourcePath)
  5. createImageIcon(URL url)
  6. createImageIconJLabel(ClassLoader classloader, String path, String description, String text)
  7. createImageIcons(java.awt.Image... images)
  8. getIconImage(Icon icon)
  9. getIconImage(String path)