Get JTable from selected tab at JTabbedPane

被刻印的时光 ゝ 提交于 2019-12-22 11:08:11

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/20145916/get-jtable-from-selected-tab-at-jtabbedpane

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!