how to add icon to button Java code example Example: add image on JButton buttonB.setIcon(new ImageIcon(this.getClass().getResource("imagename")));