Bonjour à tous les développeurs,

je n'arrive pas à faire apparaître sur ma frame ma listbox en meme temps que ce qu'il y a sur la méthode paint().
si je desactive paint(), ma liste apparait
quand j'active paint(), ma liste disparait
je fais quoi ??

voici mon code

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
import java.awt.*;
import javax.swing.*;
 
public class MonCanvas2 extends Frame
     {  
 
    private JScrollPane jScrollPane1;
 
    private JList ListeCouleur;
public MonCanvas2() 
      {  
this.setTitle("Form");
this.setSize(300,300);
FlowLayout fl = new FlowLayout();
this.setLayout(fl); 
 JLabel label1 = new JLabel("Nombre 1 :"); //label texte
this.add(label1);
TextField t=new TextField(12);
this.add(t);
 
Button b1;
b1=new Button("ok");
this.add(b1);
 
////////////////////////////////////////////////
 
 jScrollPane1 = new javax.swing.JScrollPane();
 ListeCouleur = new javax.swing.JList();
 ListeCouleur.setBackground(new java.awt.Color(255, 255, 153));
        ListeCouleur.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 153, 0), 3, true));
        ListeCouleur.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Rouge", "Bleu", "Jaune", "Vert", "Noir" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        ListeCouleur.setToolTipText("Liste des Couleurs");
        ListeCouleur.setSelectionForeground(new java.awt.Color(255, 255, 102));
 
         jScrollPane1.setViewportView(ListeCouleur);      
 
////////////////////////////////////////////////////
 
this.add(ListeCouleur);
this.show();
 
}
 
public void paint(Graphics g)
{
g.setColor(Color.red);
//g.drawString("Nom",30,50);
//g.drawString("Prénom",30,70);
g.setColor(Color.blue);
g.fillRect(30,100,80,100);
g.setColor(Color.pink);
g.fillOval(30,160,80,100);
 
 
}
 
public static void main (String[ ] args)
{
  new MonCanvas2() ;
 }
 
 }

merci de m'aider !!