javaの魂100まで-6

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class J {
public static void main(String[] arg) {
J6 frame = new J6();
frame.setVisible(true);
}
}
//implements インターフェースの実装
class J6 extends JFrame implements ActionListener {
JLabel label;
JButton button;
J6() {
setBounds(0,0,400,300);
setDefaultCloseOperation(EXIT_ON_CLOSE);
label = new JLabel();
button = new JButton("1");
setLayout(new FlowLayout());
add(label);
add(button);
//addActionListener アクションイベント受渡の設定
button.addActionListener(this);
}
//actionPerformed アクションイベント受取のメソッド
public void actionPerformed(ActionEvent e) {
label.setText("1");
}
}
/*

演習問題

ボタンをクリックしたときに、
ボタンに表示されている文字が2になるようにしてください。

*/