java button click event code example
Example 1: java swing button on click
JButton b = new JButton("push me");
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//your actions
}
});
Example 2: how to create an action listener in java
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent)
{
}
});