please help...
here's the code
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JOptionPane;
import javax.swing.JButton;
import javax.swing.Icon;
import javax.swing.ImageIcon;
public class Button extends JFrame{
private JButton reg;
private JButton custom;
public Button(){
super("BUTTON");
setLayout(new FlowLayout());
reg = new JButton("reg BUTTON");
add(reg);
Icon b = new ImageIcon(getClass().getResource("C://User//Jeffery//workspace//Jeffery//src//button.png"));
custom = new JButton("CUSTOM BUTTON", b);
add(custom);
HandlerClass handler = new HandlerClass();
reg.addActionListener(handler);
custom.addActionListener(handler);
}
private class HandlerClass implements ActionListener{
public void actionPerformed(ActionEvent event){
JOptionPane.showMessageDialog(null, String.format("%s", event.getActionCommand()));
}
}
}
I have a button picture named button.png