bonjour,
voici mon code
mon probleme c'est que je veux afficher le label (à faire) quand je clique sur un autre boutton autre que structure linéaire
merci

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import java.awt.BorderLayout;
 
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
 
 
public class Fenetre extends JFrame {
 
      // private JButton bouton = new JButton("interface graphique");
       private JPanel panel=new JPanel();
       JPanel pan4=new JPanel();
 
       JLabel label=new JLabel();
 
 
       String [] tab={"Structure Linéaire","Arbre","Graphe","Aide","A propos de"};
       JButton[] tab_button = new JButton[tab.length];
 
        public Fenetre(){
 
               super("interface graphique");
 
               /* bouton.addActionListener(new SLi());*/
                this.setSize(300, 300);
                this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                this.setLocationRelativeTo(null);
               // panel.setBackground(Color.white);
               // JPanel south = new JPanel();
                //south.add(bouton);
                panel.setLayout(new BorderLayout());
 
 
 
                this.setVisible(true);
                this.setContentPane(panel);
 
                JPanel pan= new JPanel();
                JPanel pan1=new JPanel();
                JPanel pan2=new JPanel();
               for (int i=0;i<tab.length;i++){
            	   tab_button[i]=new JButton(tab[i]);
            	   switch(i){
            	   case 0:
            		   tab_button[i].addActionListener(new SLi());
            		   pan.add(tab_button[i]);
            	   case 1:
            		   tab_button[i].addActionListener(new pardef());
            		   pan1.add(tab_button[i]);
            	   case 2:
            		   tab_button[i].addActionListener(new pardef());
            		   pan2.add(tab_button[i]);
            	   default :
            		   tab_button[i].addActionListener(new pardef());
            	   pan2.add(tab_button[i]);
            	   }
               }                panel.add(pan, BorderLayout.SOUTH);
                                panel.add(pan1,BorderLayout.EAST);  
                                panel.add(pan2,BorderLayout.WEST);
                             	  panel.add(pan4,BorderLayout.NORTH);
 
        }      
 
     public class SLi  implements ActionListener{
 
 
        public void actionPerformed(ActionEvent arg0) {
 
            new Slineaire();
           // setVisible(false);
 
    }
        }
     public class pardef implements ActionListener{
    	 public void actionPerformed(ActionEvent arg){
    		 label.setText("à faire");
             pan4.add(label);
 
 
    	 }
     }           
 
}