BUT2/DEV/DEV2.1/TP10_exceptions.java/Q5_Degres/Q1Main.java~

31 lines
803 B
Java
Raw Permalink Normal View History

2023-10-23 13:23:36 +02:00
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Q1Main{
public static void main(String[] args) {
JFrame fenetre = new JFrame();
fenetre.setSize(500, 300);
fenetre.setLocation(0, 0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton boutonCyan = new JButton("Cyan");
JButton boutonMagenta = new JButton("Magenta");
JButton boutonJaune = new JButton("Jaune");
JPanel contenu = new JPanel();
contenu.add(boutonCyan);
contenu.add(boutonMagenta);
contenu.add(boutonJaune);
FondEvent evenementBouton = new FondEvent(contenu);
boutonCyan.addActionListener(evenementBouton);
boutonMagenta.addActionListener(evenementBouton);
boutonJaune.addActionListener(evenementBouton);
fenetre.add(contenu);
fenetre.setVisible(true);
}
}