set Window Icon - Java Swing

Java examples for Swing:JWindow

Description

set Window Icon

Demo Code


//package com.java2s;
import java.awt.Window;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class Main {
    public static void setIcon(final Window frame) {
        try {/*from w  w  w  .  j av  a  2  s.c  o m*/
            frame.setIconImage(ImageIO.read(new File(
                    "assets/textures/ic_launcher.png")));
        } catch (IOException e) {
            // Ignore
        }
    }
}

Related Tutorials