Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 528
crzbt Avatar asked Dec 02 '25 12:12

crzbt


1 Answers

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.

like image 50
Leo Pflug Avatar answered Dec 05 '25 00:12

Leo Pflug



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!