从JTabbedPane的选定选项卡获取JTable [英] Get JTable from selected tab at JTabbedPane
本文介绍了从JTabbedPane的选定选项卡获取JTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有JTabbedPane,其中包含许多生成的动态JPanel,其中包含JTable。如何从选定的JTabbedPane选项卡中获取/设置JTable?
I have JTabbedPane with many generated dynamically JPanels, that contains JTable. How can i get/set JTable from the selected JTabbedPane tab?
已经尝试使用JTabbedPane.getComponents(),但它不包含任何JTable组件。
Already tried to use JTabbedPane.getComponents(), but it doesn't contain any JTable components.
推荐答案
myPane.getSelectedComponent().getComponents();
将为您提供所选标签组件的所有组件。
如果JPanel中有超过1个组件,您可以使用循环搜索JTable类。
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.
这篇关于从JTabbedPane的选定选项卡获取JTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文