Salut,

J'ai un panel constitué à gauche d'un arbre et à droite d'un Panel de style CardLayout. J'ajoute des panels dans ce CardLayout et quand je clique sur un noued, je demande l'affichage du panel correspondant. Enfin, ça c'est ce que je veux faire mais en fait le panel affiché ne change pas

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
   private void GuiBuild()
    {
        setLayout(new BorderLayout());
 
        // construction de l'arbre permettant d'accéder aux différents types d'options
        _tree.setRootVisible(false);
 
        final DefaultMutableTreeNode General  = new DefaultMutableTreeNode("General"),
        			     CRM      = new DefaultMutableTreeNode("CRM");
        _treeModel.insertNodeInto(General, _treeRootNode, _treeRootNode.getChildCount());
	_treeModel.insertNodeInto(CRM, 	   _treeRootNode, _treeRootNode.getChildCount());
	_treeModel.nodeStructureChanged(_treeRootNode);
 
        JScrollPane treeScrollPane = new JScrollPane();
        treeScrollPane.setViewportView(_tree);
 
        // Listener de souris
        MouseListener ml = new MouseAdapter() 
        {
            public void mouseClicked(MouseEvent e)
            {
            	DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)_tree.getLastSelectedPathComponent();
            	activePanel(selectedNode.toString());
            }
        };
        _tree.addMouseListener(ml);
        add(treeScrollPane, BorderLayout.WEST);
 
        // Panel contenant les sous-panels
        JPanel panel = new JPanel();
        _layout = new CardLayout();
	panel.setLayout(_layout);
        add(panel, BorderLayout.CENTER);
 
        // Construction des panels relatifs à chaque domaine
        _panelsettingsGeneral 	= new uDlgSettingsGeneral();
        JScrollPane scrollPaneGeneral = new JScrollPane(_panelsettingsGeneral);
        scrollPaneGeneral.setBorder(BorderFactory.createEmptyBorder());
        panel.add("General", scrollPaneGeneral);
	_layout.addLayoutComponent(scrollPaneGeneral, "General");			
 
        _panelsettingsCRM 	= new uDlgSettingsCRM();
        JScrollPane scrollPaneCRM = new JScrollPane(_panelsettingsCRM);
        scrollPaneCRM.setBorder(BorderFactory.createEmptyBorder());
        panel.add("CRM", scrollPaneCRM);
	_layout.addLayoutComponent(scrollPaneCRM, "CRM");		
    }
 
    private void activePanel(String panelName)
    {
	_layout.show(this, panelName);
    }
Lors d'un click sur un noeud, la méthode activePanel est bien appelée avec le bon nom mais le panel ne change pas

Merci pour votre aide