1 pièce(s) jointe(s)
Afficher un JPanel dans un autre JPanel d'un JFrame
Bonjour
j'ai une class MainFrameA et une class NI_JPanel ( avec des composants)
dans la class MainFrame j'ai ajouter un Event sur un JButton pour faire appel au NI_JPanel dans un JPanel de la class MainFrame je veut afficher le NI_JPanel avec ses composant dans un JPanel de la MainFrame.
mon problème que le 2éme JPanel ne s'affiche pas
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| JButton btnNI = new JButton("N_Installation");
btnNI.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
//appel constructeur NI_JPanel
NI_JPanel p_NI = new NI_JPanel();
JPanel panel_2 = new JPanel();
contentPane.add(panel_2);
SpringLayout sl_panel_2 = new SpringLayout();
panel_2.setLayout(sl_panel_2);
sl_panel_2.putConstraint(SpringLayout.NORTH, p_NI, 10, SpringLayout.NORTH, panel_2);
sl_panel_2.putConstraint(SpringLayout.WEST, p_NI, 10, SpringLayout.WEST, panel_2);
sl_panel_2.putConstraint(SpringLayout.EAST, p_NI, -10, SpringLayout.EAST, panel_2);
panel_2.add(p_NI);
}
}); |
http://www.developpez.net/forums/att...on/titre2.jpg/
http://www.developpez.net/forums/att...capture22.jpg/