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
| import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class TEST extends JFrame {
public static void main(String[] arguments)
{
TEST b3 = new TEST();
b3.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent evenement ) {
JOptionPane.showMessageDialog(null,"FIN DE L'APPLICATION");
System.exit( 0 );
}
});
}
public TEST() {
super("Program");
setSize(350,225);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton alpha = new JButton("Alpha");
JButton beta = new JButton("Beta");
JButton gamma = new JButton("Gamma");
JPanel content = new JPanel();
content.setLayout(null);
content.add(alpha);
content.add(beta);
content.add(gamma);
add(content);
pack();
setVisible(true);
}
} |
Partager