« Return to Thread: Adding jpanels to existing frame

Adding jpanels to existing frame

by cbyron2003 :: Rate this Message:

Reply to Author | View in Thread

Hi all.
Just looking for some advice regarding a UI i am producing using netbeans. Not sure if this is neing posted in correct area so if not either move it or let me know and i will repost elsewhere.
I have a jframe  which consists of a jpanel and a button. I also have a seperate class which produces another jPanel. When the button is clicked in the original jframe i want to replace the first jpanel with the second. I had thought that when the button was clicked I could simply do a 1stPanel.add(2ndPanel) and then a repaint() but this is not working.
I think that something needs to change in the layout manager but as netbeans creates this I am not sure how or what to change.
I will eventually have several classes all creating independent Jpanels and I would like to add these to my original frame as and when i require them so any help or ideas and hw this might be done would be greatly appreciated.

Thanks

 « Return to Thread: Adding jpanels to existing frame

LightInTheBox - Buy quality products at wholesale price