[java] TabbedPane Tab Listener

Started by
2 comments, last by Halsafar 18 years, 4 months ago
Im working on an app which requires a tabbed pane. I began testing it quickly I realized my UI will need to know when a tab is clicked and which one. I found I can add a ChangeListener into the JTabbedPane and it only gets fired when the tabs are changed. However I can not get any relevant information out of the ChangeEvent. So I have no idea which tab has been selected and that is what I need to keep track of. The state of the application is dependant on what tab the user is looking at. Any advice?
Advertisement
Have you looked at JTabbedPane's getSelectedComponent() or getSelectedIndex()? They look as though they might help you out.
bleb is right, I had this problem a while back and those methods will solve your problem
Excellent, before I even read the API or confirm it I'll just take it as truth.
Thanks guys.

This topic is closed to new replies.

Advertisement