Example usage for javax.swing JLabel getIcon

List of usage examples for javax.swing JLabel getIcon

Introduction

In this page you can find the example usage for javax.swing JLabel getIcon.

Prototype

public Icon getIcon() 

Source Link

Document

Returns the graphic image (glyph, icon) that the label displays.

Usage

From source file:ui_server.frmScreenShut.java

private void imageImpiliment(JLabel img) {
    ImageIcon IIC = (ImageIcon) img.getIcon();
    Image image = IIC.getImage();
    BufferedImage buffered = (BufferedImage) image;
    try {//  www  .j a va 2 s  . c o  m
        File outputfile = new File("saved.png");
        ImageIO.write(buffered, "png", outputfile);
    } catch (IOException e) {
    }
}