Java Image displayImage(Image img)

Here you can find the source of displayImage(Image img)

Description

display Image

License

LGPL

Declaration

public static void displayImage(Image img) 

Method Source Code


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

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Image;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;

public class Main {
    public static void displayImage(Image img) {
        JFrame f = new JFrame("DEBUG IMG");

        JLabel label = new JLabel(new ImageIcon(img));
        label.setBorder(BorderFactory.createLineBorder(Color.RED));
        f.setLayout(new BorderLayout());
        f.add(label, BorderLayout.WEST);
        f.pack();//from   w ww .j a v  a 2s. co m
        f.setVisible(true);
        f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    }
}

Related

  1. createScaledImage(Image inImage, int inWidth, int inHeight)
  2. createShadowPicture(Image buf)
  3. createTiledImage(Image img, int width, int height)
  4. crop(Image source, int x1, int y1, int x2, int y2)
  5. displayImage(Image image)
  6. displayImage(Image img, String mesg, int locx, int locy, int sizex, int sizey)
  7. divideImage(Object obj, int rows, int cols)
  8. ensureImageLoaded(Image img)
  9. findImagefromClasspath(Class relToThisClass, String relImageName)