how to change the icon of a jframe

Java
frame.setIconImage(img);
Source

Also in Java: