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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
package projet.superrep.rep2;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import projet.superrep.rep1.*;
public class classeihm extends JFrame {
private Container cp;
private JPanel ecran;
private JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18;
public classeihm(){
super("titre");
Container cp = getContentPane();
JPanel ecran = new JPanel(new BorderLayout());
String[] menu_ppal = {"menu 1", "menu 2"};
JList liste_menu_ppal = new JList(menu_ppal);
ecran.add(liste_menu_ppal,BorderLayout.NORTH);
String[] menu_1 = {"a","b","c","d","e"};
JList liste_menu_1 = new JList(menu_1);
String[] menu_2 = {"f","g","h","i"};
JList liste_menu_2 = new JList(menu_2);
JButton b1 = new JButton ("");
JButton b2 = new JButton ("");
JButton b3 = new JButton ("");
JButton b4 = new JButton ("");
JButton b5 = new JButton ("");
JButton b6 = new JButton ("");
JButton b7 = new JButton ("");
JButton b8 = new JButton ("");
JButton b9 = new JButton ("");
JButton b10 = new JButton ("");
JButton b11 = new JButton ("");
JButton b12 = new JButton ("");
JButton b13 = new JButton ("");
JButton b14 = new JButton ("");
JButton b15 = new JButton ("");
JButton b16 = new JButton ("");
JButton b17 = new JButton ("");
JButton b18 = new JButton ("");
JPanel jp = new JPanel(new GridLayout(4,3,5,5));
JPanel jp4 = new JPanel(new BorderLayout(5,5));
JPanel jp5 = new JPanel(new BorderLayout(5,5));
jp.add (b7);
jp.add (b8);
jp.add (b9);
jp.add (b10);
jp.add (b11);
jp.add (b12);
jp.add (b13);
jp.add (b14);
jp.add (b15);
jp.add (b16);
jp.add (b17);
jp.add (b18);
jp4.add("North",b3);
jp4.add("East",b6);
jp4.add("South",b4);
jp4.add("West",b5);
jp5.add("North",ecran);
jp5.add("East",b1);
jp5.add("South",jp);
jp5.add("West",b2);
jp5.add("Center",jp4);
cp.add("Center",jp5);
ecouteur1 e1 = new ecouteur1 (ecran, liste_menu_ppal, liste_menu_1, liste_menu_2);
b1.addActionListener(e1);
pack();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
} |
Partager