Salem,
je suis débutante en java et je fait le code suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
import java.awt.*;
import javax.swing.*;
import java.util.*;
 
class frame_acl extends JFrame{
    GridLayout monLayout;
    JLabel nom=new JLabel("Nom_acl");
    JLabel type=new JLabel("Type_acl");
    JLabel valeur=new JLabel("Valeur");
    JTextField txt1 = new JTextField("");
    JTextField txt2 = new JTextField("");
    JComboBox box = new JComboBox();
        Button create = new Button("créer");
    JLabel lb = new JLabel();
 
    public frame_acl()
    {
        super("Ajout d'ACL");
                this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
                this.setBounds (500,500, 400, 550);
        this.setSize(400,400);
        JPanel p1 = new JPanel();
        p1.setLayout(new GridLayout(2,1));
        p1.add(lb);
        JPanel p2 = new JPanel();
        p2.setLayout(new GridLayout(4,2));
        p2.add(nom);
        p2.add(type);
        p2.add(valeur);
        p2.add(create);
        p2.add(txt1);
        p2.add(txt2);
        p2.add(box);        
        lb.setIcon(new ImageIcon("img4.jpg"));        
        this.setVisible(true);    
    }
     public static void main(String args[])
     {
        new frame_acl();
     }
 
}
je fait la compilation et tous ça va bien.
mon probléme est qu'aucun du composant de la fenetre n'est affiché.
la fenetre s'affiche sans bouton,labe, text..
et je comprend pas le raison.
je travaille sou linux.
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Server VM (build 1.5.0_12-b04, mixed mode).