Here you can find the source of displayImage(final String windowTitle, final BufferedImage image)
public static void displayImage(final String windowTitle, final BufferedImage image)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import java.awt.image.BufferedImage; public class Main { public static void displayImage(final BufferedImage image) { displayImage("", image); }/*from w w w . j a va 2s . c o m*/ public static void displayImage(final String windowTitle, final BufferedImage image) { new JFrame(windowTitle) { { final JLabel label = new JLabel("", new ImageIcon(image), 0); add(label); pack(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setVisible(true); } }; } }