SWING pb de Raffraichissement
Bonjour a tous,
J'ai une application Swing avec une JDialog et un panel à l'interieur
et un arbre
en fonction du clic sur l'arbre, je change le panel
dont voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| DefaultMutableTreeNode node = (DefaultMutableTreeNode)mTree.getLastSelectedPathComponent();
if (node != null)
{
OptionPanel opPanel = ((OptionPanel)mInnerPanel.getComponent(2));
// je supprime l'ancien panel
mInnerPanel.remove(opPanel);
OptionPanel topPanel = ((PreferenceTreeNode)node).getOptionPanel();
// je rajoute le nouveau
mInnerPanel.add(topPanel,BorderLayout.CENTER,2);
// this <- ma Jdialog je valide le changement
// j'ai essaye avec mInnerPanel.revalidate() qui fait la meme chose
this.validate();
} |
les panels que je recupere sont generes qu'une seule fois
mais si je cree un nouveau panel, le raffraichissement marche
une idee ??