action listener on button java code example
Example 1: actionlistener java
JButton Button = new JButton();
Button.setSize(300,300);
Button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
System.out.println(BlockNumber)
}
});
Example 2: how to create an action listener in java
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent)
{
}
});
Example 3: action listener of jbutton
jBtnSelection.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectionButtonPressed();
}
} );