I need to show the content of one panel class into another panel of another class ..i am new to java so i would appreciate any help...plz help me...
in short i just want to add one panel into another through actionlistener of some button..

i just want to add one panel into another

You use the add() method to add a component to a container.
A panel is both a component and a container so one can be added to another.

through actionlistener of some button..

Doing this could change the GUI layout. You will need to tell the parent container that it needs to redo its layout if a new component is added to it.

Kudos for NormR1 speed ;)

Please do not post "I'm new I need help" claiming to be new is just lame excuse for not trying.
JPanel extends JComponent that on other and extends Container, therefore you do inherit methods from there. Container has number of add() methods but following two can be of most interest to you add(Component comp) and add(String name, Component comp).

PS: Always try to read API for given class and try to understand what it can offer to you directly by declaration in it self, by inheritance.

commented: Always try to read API +9

thanx for advice i'll never use such word now....i tried it nut not working... let me explai the problem in detail i have one main frame containing a menu and a panelA and another clss call FeePanel with some componets so what i want is when i click a menu in 1st main frame then the FeePanel should be displayed in PanelA...thanx in advance

Kudos for NormR1 speed ;)

Please do not post "I'm new I need help" claiming to be new is just lame excuse for not trying.
JPanel extends JComponent that on other and extends Container, therefore you do inherit methods from there. Container has number of add() methods but following two can be of most interest to you add(Component comp) and add(String name, Component comp).

PS: Always try to read API for given class and try to understand what it can offer to you directly by declaration in it self, by inheritance.

What have you tried?
The adding of the panel would be something like:
panelA.add(freePanel);

The problem is: What is already in PanelA? Does its contents have to be moved around?
Where in the layout of PanelA do you want the FreePanel to be shown?
If PanelA is empty, that would make it easier.

yaeh there is nothing in panelA and i want freepanel to be shown with its content on panelA on click of a button. thnx

What have you tried?
The adding of the panel would be something like:
panelA.add(freePanel);

The problem is: What is already in PanelA? Does its contents have to be moved around?
Where in the layout of PanelA do you want the FreePanel to be shown?
If PanelA is empty, that would make it easier.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.