crzbt
crzbt

Reputation: 183

Get JTable from selected tab at JTabbedPane

I have JTabbedPane with many generated dynamically JPanels, that contains JTable. How can i get/set JTable from the selected JTabbedPane tab?

Already tried to use JTabbedPane.getComponents(), but it doesn't contain any JTable components.

Upvotes: 3

Views: 3394

Answers (1)

Leo Pflug
Leo Pflug

Reputation: 544

myPane.getSelectedComponent().getComponents();

will give you all components of the selected tab's component. You can search with a loop for the class JTable, if there is more than 1 component in your JPanel.

Upvotes: 3

Related Questions