1import java.awt.event.ActionEvent;
2import java.awt.event.ActionListener;
3
4/*in main*/
5button.addActionListener(new ActionListener() {
6 public void actionPerformed(ActionEvent e) {
7 System.out.println('x');
8 }
9});
1button.addActionListener(new ActionListener() {
2 @Override
3 public void actionPerformed(ActionEvent actionEvent)
4 {
5
6 }
7 });
1JButton Button = new JButton();
2Button.setSize(300,300);
3Button.addActionListener(new ActionListener() {
4 public void actionPerformed(ActionEvent e)
5 System.out.println(BlockNumber)
6 }
7});