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
|
import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.*;
public class Ex {
private JButton search = new JButton("Rechercher");
JFrame frame = new JFrame("Ex");
private JTextField a = new JTextField(20);
private JTextField b = new JTextField(20);
private JTextField c = new JTextField(20);
private JTextField d = new JTextField(20);
private JTextField e = new JTextField(20);
private JTextField f = new JTextField(20);
Ex() {
JFrame frame = new JFrame ("Ex");
JPanel mainPanel = new JPanel(new GridLayout(6, 3));
String[] searchList = { "Albert", "Jean", "Charles", "Nicolas", "Cedric", "Roger"};
mainPanel.add(new JLabel("A",JLabel.CENTER)) ;
JComboBox searchListe1 = new JComboBox(searchList);
mainPanel.add(searchListe1);
mainPanel.add(a);
mainPanel.add(new JLabel("B",JLabel.CENTER)) ;
JComboBox searchListe2 = new JComboBox(searchList);
mainPanel.add(searchListe2);
mainPanel.add(b);
mainPanel.add(new JLabel("C",JLabel.CENTER)) ;
JComboBox searchListe3 = new JComboBox(searchList);
mainPanel.add(searchListe3);
mainPanel.add(c);
mainPanel.add(new JLabel("D",JLabel.CENTER)) ;
JComboBox searchListe4 = new JComboBox(searchList);
mainPanel.add(searchListe4);
mainPanel.add(d);
mainPanel.add(new JLabel("E",JLabel.CENTER)) ;
JComboBox searchListe5 = new JComboBox(searchList);
mainPanel.add(searchListe5);
mainPanel.add(e);
mainPanel.add(new JLabel("F",JLabel.CENTER)) ;
JComboBox searchListe6 = new JComboBox(searchList);
mainPanel.add(searchListe6);
mainPanel.add(f);
JPanel boutonsPanel = new JPanel();
boutonsPanel.add(search);
frame.add(mainPanel, BorderLayout.CENTER);
frame.add(boutonsPanel, BorderLayout.SOUTH);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) throws Exception {
new Ex();
}
} |
Partager