Java tutorial
import javax.swing.ImageIcon; import javax.swing.JButton; public class Main { public static void main(String[] argv) throws Exception { JButton button = new JButton(); // Add or change the icon; it will appear to the left of the text button.setIcon(new ImageIcon("icon.gif")); // Set to null to remove icon button.setIcon(null); } }