MainClass.java
899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package tp2.evenements;
import javax.swing.*;
import java.awt.*;
public class MainClass {
public static void main(String[] args) {
JLabel label = new JLabel("0");
label.setFont(new Font("SansSerif", Font.PLAIN, 25));
JPanel topPanel = new JPanel();
topPanel.add(label);
JButton incbutt = new JButton("incrémenter");
incbutt.addActionListener(new ReponseAuClic(label));
JPanel botPanel = new JPanel();
botPanel.add(incbutt);
JFrame win = new JFrame();
win.setLocationRelativeTo(null);
BoxLayout layout = new BoxLayout(win.getContentPane(), BoxLayout.Y_AXIS);
win.setLayout(layout);
win.add(topPanel);
win.add(botPanel);
win.setResizable(false);
win.pack();
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
win.setVisible(true);
}
}