I want to set access of a jpanel(which is in the JDesktopPane ) from JInternalFrame, I set it to public but no way its gives 'null' when I do some test like that:
JDesktop frameP = new JDesktop();
frameP.jPanel1.setVisible(true); //This is what I want but it doesn't work
System.out.println("Name " + frameP.jPanel1.getName());
so the last line gives me null that it means that he doesn't get the JPanel.
I try also that code:
for(int k=0; k<frameP.getContentPane().getComponentCount();k++ ){
if(frameP.getContentPane().getComponent(k)instanceof JPanel){
JPanel pnl = (JPanel) frameP.getContentPane().getComponent(k);
if(pnl.getName().equals("jPanel1")){
pnl.setVisible(true);
}
System.out.println("Nom pnl: " +pnl.getName()); // That gives null too
}
}
Any help please?