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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import java.io.File;
public class ArboIHM extends JFrame {
private JPanel panel = new JPanel();
private JPanel boutons = new JPanel();
private JButton triNom = new JButton("Arborescence triée par nom");
private JButton triTaille = new JButton("Arborescence triée par taille");
//private JButton TriDate = new JButton("Arborescence triée par date");
private File test = new File(".");
// private ArboTrieeParNom a1 = new ArboTrieeParNom(test);
// private JList laListe = new JList(a1.getListe().toArray());
private JList laListe = new JList();
private JLabel nomLabel = new JLabel("Nom : ");
private JLabel tailleLabel = new JLabel("Taille : ");
private JLabel dateLabel = new JLabel("Date : ");
private JPanel nom = new JPanel();
private JPanel taille = new JPanel();
private JPanel date = new JPanel();
private JTextField nomTexte = new JTextField(20);
private JTextField tailleTexte = new JTextField(20);
private JTextField dateTexte = new JTextField(20);
private JScrollPane scrollPane = new JScrollPane(laListe);
private Component [] tabComp = {laListe,triNom,triTaille, nom, date, taille};
JPanel mainContainer = new JPanel(); // panel de référence de la frame
private JLabel label= new JLabel(); // label qui contient les éléments
public ArboIHM() {
init();
for(int i = 0 ; i<tabComp.length;i++) {
label.add(tabComp[i]);
}
}
public void init(){
setTitle("Test");
pack();
this.setSize(800,600);
this.setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
this.add(label);
nom.add(nomLabel);
nom.add(nomTexte);
date.add(dateLabel);
date.add(dateTexte);
taille.add(tailleLabel);
taille.add(tailleTexte);
laListe.setBounds(260,250,200,25);
triNom.setBounds(260,290,200,25);
triTaille.setBounds(260,330,200,25);
nom.setBounds(200,400,300,25);
date.setBounds(200,450,300,25);
taille.setBounds(200,500,300,25);
// panel.setLayout(new GridBagLayout());
// gbc.gridx = 0;
// gbc.gridy = 1;
// panel.add(laListe, gbc);
// gbc.gridwidth = GridBagConstraints.REMAINDER;
// gbc.gridx = 3;
// gbc.gridy=0;
// panel.add(triNom, gbc);
//
// gbc.gridwidth = GridBagConstraints.REMAINDER;
// gbc.gridx = 3;
// gbc.gridy=1;
// panel.add(triTaille, gbc);
//
// gbc.gridx = 3;
// gbc.gridy = 2;
// panel.add(nom, gbc);
//
// gbc.gridx = 3;
// gbc.gridy = 3;
// panel.add(date, gbc);
//
// gbc.gridx = 3;
// gbc.gridy = 4;
// panel.add(taille, gbc);
}
public static void main(String... args) {
new ArboIHM();
}
} |
Partager