I need to determine which tabs in a JTabbedPane need updated by determining the contents of each tab's component. From what I can determine, there is no way to iterate through each tab using the default JTabbedPane model.
Does anyone have any ideas as to what I could do in this situation?
You should use the method JTabbedPane. setSelectedIndex(int index) with the index of the tab you want. Save this answer.
To Create Tabbed Panes. To create a tabbed pane, instantiate JTabbedPane , create the components you wish it to display, and then add the components to the tabbed pane using the addTab method.
In Swing, JTabbedPane is simply a specialized container. Each tab has a name. To add a tab to the JTabbedPane , simply call addTab() . You'll need to specify the name of the tab as well as a component that supplies the tab's contents.
if you use something like:
int totalTabs = tabbedPane.getTabCount();
for(int i = 0; i < totalTabs; i++)
{
Component c = tabbedPane.getTabComponentAt(i);
//other stuff
}
Could give you a start point to do what you want.
How about getTabCount() and getTabComponentAt( int index )?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With