[JTabbedPane] get the tab index of a textfield
Hello,
I'm using a jTabbedPane to display data. On every tab I have several panels with JTextFields. I would like to know on wich index of the tabpane a textfield is located. So when a textfield is empty I can use tabpane.setSelectedIndex( i ) to set te focus to that tab.
Enyone any tips?
Greetings
Hans
Thank for your input. But this is not what I want, I want to perform a check on an array of fields at moment a user want's to save a record. With an actionhandler to every textfield I would have to check at every field again.But thank anyway.
I'm guessing that just setting focus on the text field doesn't cause the tab selection to change.
So here's a brute force way to do it:
a) find the parent container of the text field
b) use the tabbedPane.getComponentAt(..) method to compare the above component. When they are equal you now which tab contains the text field.