You can add a ChangeListener to listen to changes that have already happened, but as far as I know there's no way to block changing the selected tab. You can of course change back to the first tab instead.
Rob Spoor wrote:as far as I know there's no way to block changing the selected tab.
The selection takes place in the JTabbedPane's model. To repeat what I said on another forum in respect of unusual requirements for selection in a JList, weird selection behavior requires an equally weird selection model.