DEV_BUT1/DEV2.1/TP08/MainButton.java

32 lines
736 B
Java
Raw Normal View History

2023-04-04 14:03:16 +02:00
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MainButton{
public static void main(String[] args){
JFrame fenetre = new JFrame()
; JPanel panneau2 = new JPanel();
Fond ctrl = new Fond(panneau2);
JRadioButton cyan = new JRadioButton("CYAN");
JRadioButton magenta = new JRadioButton("PINK");
JRadioButton jaune = new JRadioButton("YELLOW");
ButtonGroup grp = new ButtonGroup();
grp.add(cyan);
grp.add(magenta);
grp.add(jaune);
cyan.addActionListener(ctrl);
magenta.addActionListener(ctrl);
jaune.addActionListener(ctrl);
panneau2.add(cyan);
panneau2.add(magenta);
panneau2.add(jaune);
fenetre.add(panneau2, BorderLayout.CENTER);
fenetre.setVisible(true);
}
}