Check out example codes for "java swing change label icon". It will help you in understanding the concepts better.

Code Example 1

// pic is the label variable name
//b2.png is the picture 
pic.setIcon(new javax.swing.ImageIcon(getClass().getResource("b2.png")));

Learn ReactJs, React Native from akashmittal.com