Setting the top-left icon in a JFrame

setIconImage (inherited method from java.awt.Frame) does the job!

 
import javax.swing.*;
import java.awt.*;
   
public class IconFrame extends JFrame {
 
   public IconFrame() {
      setSize(100, 100);

      setIconImage(new ImageIcon("test.gif").getImage());
   }
 
   public static void main(String args[]) {
      new IconFrame().setVisible(true);     
   }
}