Here is the code which displays button with icon. Check you code with this.
class gifButton extends JFrame{
gifButton(){
// create image icon
Icon fileg = new ImageIcon("*.GIF");
Icon setupg = new ImageIcon("*.GIF");
// create button with icon
JButton file = new JButton("File", fileg);
JButton setup = new JButton("Setup", setupg);
/* // Alternate method - of creating a button with icon.
JButton file = new JButton("File");
JButton setup = new JButton("Setup");
file.setIcon(fileg);
setup.setIcon(setupg); */
getContentPane().setLayout(new GridLayout(3,2));
getContentPane().add(file);
getContentPane().add(setup);
pack();
setVisible(true);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
public static void main(
String arg[]){
new gifButton().show();
}
}