I have 2 frames. One contains buttons that do appropriate actions on data. And secnd frame which contains data in tab view.
Now I have to add one button in first frame by clicking on this button a new tab should be added on second frame. How can I do this?
I have 2 frames. One contains buttons that do appropriate actions on data. And
Share
Make the
JTabbedPaneof the second frame accessible in first frame and then just simply calladd()method ofJTabbedPaneto add a new tab in it.Following is a sample code for that:
First frame:-
Second frame:-
Decalre a global variable of tabbedPane
Initializaition code
Action on button click in first frame:-