Put the code below in the JFrame's Properties form. This will put the code in the NetBean's generated code block.
To do this, go to the Design mode, right click on the JFrame->Properties. Click the ellipsis button next to
iconImage in the Properties form and choose Custom Code.