Java BufferedImage to ImageIcon toSwingImage(final BufferedImage image)

Here you can find the source of toSwingImage(final BufferedImage image)

Description

to Swing Image

License

Apache License

Declaration

public static JLabel toSwingImage(final BufferedImage image) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;

public class Main {
    public static JLabel toSwingImage(final BufferedImage image) {
        JLabel label = new JLabel(new ImageIcon(image));
        label.setAlignmentX(JComponent.CENTER_ALIGNMENT);
        return label;
    }//from   w w  w .j  a  v  a 2  s . c  o m
}

Related

  1. getImageIcon(BufferedImage img)
  2. getImageIcon(final BufferedImage image)
  3. scaleImageToIconImage(final BufferedImage img, final int maxHeight, final int maxWidth, final boolean preserveAspectRatio, final boolean doHighQuality)