idarke,
Thanks for the repsonse. From what I understand the ChangeListener trapps the event when it has changed. So if I am going from Tab A to Tab B the code will only have access to Tab B and will not know that the previous tab was Tab A. I have a popup menu on a Tab and when I switch from Tab A to Tab B the menu still appears, if it had not been closed before changing tabs. If I can trap the event that occurs before the tab actually changes (traditinoally know as the OnTabChanging even or something like that) I will have acess to the tab and be able to remove the popup.
I understand your problem. Even an InternalFrameListener doesn't get any events when the tab is changed. Basically the UI considers the tabbed pane as one big container, always displayed and active.
What I ended up doing was making all my JInternalFrame objects globally accessable (I made them static) so when the stateChanged event occured, I could examine them and do any needed cleanup on them. In your case, remove all popups.
idarke,
Thanks for the help. I found another work around to the problem. I create a class variable int previousSelectedTabIndex that stores the previous selected tab. When i go it ChangListener I can get the provious tab, do what i want to it and then set the previousSelectedTabIndex equal to the current index so its ready for the next tab change.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.