Java BufferedImage Display displayImage(BufferedImage image)

Here you can find the source of displayImage(BufferedImage image)

Description

display Image

License

Open Source License

Declaration

public static void displayImage(BufferedImage image) throws IOException 

Method Source Code

//package com.java2s;
/**/*from www .  j av  a  2s.  c o m*/
 * Heatmap Framework - Core
 *
 * Copyright (C) 2013   Martin Becker
 *                   becker@informatik.uni-wuerzburg.de
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/gpl-3.0.html>.
 */

import java.awt.FlowLayout;
import java.awt.image.BufferedImage;

import java.io.IOException;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class Main {
    public static void displayImage(BufferedImage image) throws IOException {
        ImageIcon icon = new ImageIcon(image);
        JFrame frame = new JFrame();
        frame.setLayout(new FlowLayout());
        frame.setSize(200, 300);
        JLabel lbl = new JLabel();
        lbl.setIcon(icon);
        frame.add(lbl);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}

Related

  1. display(final BufferedImage image)
  2. displayImage(final BufferedImage bufferedImage, final String title)
  3. displayImage(final String windowTitle, final BufferedImage image)
  4. displayImageInWindow(BufferedImage image)
  5. displayImageInWindow(BufferedImage image)