you can use
frame.setIconImage( new ImageIcon(getClass().getClassLoader().getResource("PATH/TO/YourImage.png")) );
If you want to change the
coffee-cup then you may use tools like JSmooth to create executable java file and also change the jar file icon.
As you can see in the comments
JSmooth can be used for windows operating systems. For
Mac you can check the link here on how to change the icon.
linux OS you can create a desktop
launcher and choose an icon image for it.