Setting the Icon for a Frame
import java.awt.Image; import java.awt.Toolkit; import javax.swing.JFrame; public class Main { public static void main() { JFrame frame = new JFrame(); Image icon = Toolkit.getDefaultToolkit().getImage("icon.gif"); frame.setIconImage(icon); } }